The “approved” way to do this is to use debconf. This might seem surprising if you’re not interested in actually prompting the user for the information; but beyond prompting, debconf is based on the notion of package configuration variables, and prompting is only one of the ways that can be used to provide the values for those variables. The debconf-devel manpage describes how to use this.
In your case, you’d declare the variables in your package’s templates and config script, and then use them in your postinst. To feed the values in without prompting, you’d then use pre-seeding:
write a file containing the keys and values:
<package> <config key> <config type> <value>
...
before installing the package, store its configuration:
debconf-set-selections < preseed-file
See Automating the installation of individual debian 8 packages with interactive prompts for an example.