2

I deploy my project to GAE over Github. There is some foreign API-key which I don't want to save in repository and make them public. Is it possible to set an environment variable for a project in GAE control panel so I can catch it in my application?

Qantas 94 Heavy
  • 15,750
  • 31
  • 68
  • 83
speechkey
  • 625
  • 2
  • 10
  • 16

3 Answers3

4

You can store your keys in datastore. Later when you need them in the code, you can fetch them from datastore and cache them by memcache.

Mustafa İlhan
  • 638
  • 1
  • 7
  • 18
2

I prefer using the Datastore for keys like this. See the code in my answer at Securely storing environment variables in GAE with app.yaml

That code auto-generates placeholder values that you can then update from the developer console. Also, it uses the ndb library, so reading the keys is fast.

Community
  • 1
  • 1
Martin Omander
  • 3,223
  • 28
  • 23
1

You can define environment variables in configuration file for App Engine application. In case of Python, it is app.yaml

env_variables:
   MY_ENV_VAR: 'some_value'

You can find more details here.

There is no such a thing like project parameters that can be defined in Developers Console at the moment.

pgiecek
  • 7,970
  • 4
  • 39
  • 47
  • 4
    yes, but I don't want to add private API key in a file which will be committed in the repo by Github. – speechkey Jul 10 '14 at 10:30
  • It is definitely valid, however, I am afraid that there is no such a thing like project parameters that can be defined in Developers Console. – pgiecek Jul 10 '14 at 10:35
  • 1
    Sad, heroku have something like this `heroku config:add KEY1=foobar KEY2=frobozz ` – speechkey Jul 10 '14 at 11:16