lizzie
lizzie

Reputation: 606

Is there a way to not expose credentials in the code?

I've been using ipython notebook and there are 2 information (SNOW_USER and PASSWORD) that I need to pass so I can connect to the database. I don't want to expose it for security reasons.

I tried to set as ENV VAR (environmental variables) saving it on my .bash_profile and also on .profile using export SNOW_USER='abc' but it doesn't seem ipython can find it.

import os
print os.environ['SNOW_USER']

I also tried:

%env

But the variables are not showing there either.

Any thoughts on how to do it?

Upvotes: 1

Views: 149

Answers (1)

Till
Till

Reputation: 4523

Try to create a file .env somewhere with in it :

export SNOW_USER="snow_user"
export PASSWORD="password"

and then source it :

source .env

Or just source you bash_profile file :

source ~/.bash_profile

Upvotes: 1

Related Questions