Hello, I have installed the libpostal library with Python bindings, to use for parsing postal addresses, including Python functions for a PostgreSQL server. A Python instance using the library requires a particular environment variable (LIBPOSTAL_DATA_DIR=“path/to/data/directory”) to be set. As well as the database server, I want to be able to log in remotely using ssh and run Python interactively with the same setting.
So my question is - is there a single location where I can set an environment variable and it will get picked up by both a systemd service and remote ssh sessions? I don’t want to set it in multiple locations because the value of the variable (the location of the data directory) may change.
Thanks for any tips
No. Just define it in any file you prefer and source this file in .bashrc
(or whatever shell you are using) and EnvironmentFile
service directive.
Thank you, I’ll try that