I am trying to store an Environment Variable that Python can read in as a Dictionary. If this is a bad idea, please let me know your suggestions, I am eager to learn. I'm worried that if I store the data as many environment variables it might become hard to manage.
I programmed a Raspberry Pi to unlock a door based off the Caller ID's of incoming phone calls to a Twilio number, it is working great. I want to share my code on Github for feedback but I do not want to share my list of phone numbers with the world so I am trying to save it as an environment variable and then let Python read it in.
The phone numbers are in a Python Dictionary like this.
building_admins = {
"+27792955555": "De Wet",
"+27722855555": "Marysol",
"+27878085555": "Blomerus",
}
I am trying to save it as an Environment Variable like this on Ubuntu 14.04
export BUILDING_ADMINS='{
"+27792955555": "De Wet",
"+27722855555": "Marysol",
"+27878085555": "Blomerus",
}'
1) I can't get Linux to save the environment variable, is there something I could do to make it work?
2) I feel like there must be a better way to do this and I am going in the wrong direction but nothing I seem to find with Googling is solving the problem I am facing. Please point me in the right direction.
numbers.json
by either ignoring it in the.gitignore
of your repo or placing it and reading it from a dotfile in the user's home directory, and therefore outside the repo (e.g.~/.numbers.json
). Also seeos.path.expanduser
if you choose the latter option. – Slotnick