Skip to content

Latest commit

 

History

History
31 lines (20 loc) · 695 Bytes

os-env-vars.md

File metadata and controls

31 lines (20 loc) · 695 Bytes

Hiding Passwords and Secret Keys in Environment Variables

Adding a Environment Variable (Windows)

System Menu > Advanced System Settings > Environment Variables... > in User Variables click New... > insert variable name (VAR_NAME) and value (VAR_VALUE)

When coding it may be necessary to restart your IDE or text editor.

Adding a Environment Variable (Linux and Mac)

Open the terminal:

$ cd 
$ nano .bash_profile

To the file add the line and save:

export VAR_NAME="VAR_VALUE"

When coding it may be necessary to restart your IDE or text editor.

Acessing your Environment Variables in Python

import os

var1 = os.environ.get('VAR_NAME')