I am setting up an org-mode document to connect to a postgreSQL database and execute+show the results of some queries. I don't want the database password visible in the org document (regardless of whether the document is exported: I want to be able to share the raw .org file without having to worry about the password).
I saved the password to my emacs environment with setenv
. I know I can reference it in an emacs-lisp
block with getenv
. Is there any way I can use this in an org babel header argument?
I have the following header arguments:
* Setting Up Database Connection Details
:PROPERTIES:
:header-args:sql: :engine postgres :dbuser MyUserName
:header-args:sql+: :database MyDatabaseName
:header-args:sql+: :dbpassword # [want to reference env variable here]
:header-args:sql+: :dbhost HostName
:END:
This works fine—I'm able to access the database and execute queries with the password copied in explicitly. But I'd like to replace it with a reference to the environment variable.