Define environment variables

I’m customizing ERPNext and I need to define environment variables like API_KEY and SECRET_KEY to be able to requests other services without hardcoding this information in the code. Where can I define these variables?

I try to put it in env/bin/activate script but it doesn’t work.

Thank You!

@jcgardey by default we store that information into the database, or into the site_config.json.

There’s no easy way to dinamically define the environment variables.

This is what worked for me i added a dict in my site config file with this command
bench --site {site} set-config backup ‘{“password”: “doreen”}’ --parse
and accessed it using frappe.conf.backup.get(“password”).

3 Likes