cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2462
Views
7
Helpful
2
Replies

MERAKI_API_KEY Environment Variable

Ed Roche
Level 4
Level 4

Good Morning!

Can someone tell me to proper way of setting the MERAKI_API_KEY environment variable in Linux? I get it set but everytime I reboot my system I loss it.

Thanks in advance!

Ed

1 Accepted Solution

Accepted Solutions

sungod
Level 11
Level 11

It needs to be in the environment of the user executing the scripts that need it.

If you want it just for yourself, you could edit your .profile to add...

MERAKI_API_KEY="whatever it is"
export MERAKI_API_KEY

If you will be running the Python scripts from inside a shell script wrapper (for instance if you were using cron to run the script periodically) you can put the same lines in the shell script.

At the linux shell prompt, you can type 'env' to see your environment.

View solution in original post

2 Replies 2

sungod
Level 11
Level 11

It needs to be in the environment of the user executing the scripts that need it.

If you want it just for yourself, you could edit your .profile to add...

MERAKI_API_KEY="whatever it is"
export MERAKI_API_KEY

If you will be running the Python scripts from inside a shell script wrapper (for instance if you were using cron to run the script periodically) you can put the same lines in the shell script.

At the linux shell prompt, you can type 'env' to see your environment.

Philip D'Ath
Meraki Community All-Star
Meraki Community All-Star

I personally prefer the ".env" method, which stores it in an environment file in your home directory. This is also portable across lots of different environments.

https://community.meraki.com/t5/Developers-APIs/A-newer-safer-way-to-access-the-dashboard-API/m-p/69602

Crap. That article uses referenes to the old Meraki SDK - but the concept is still legit.