dummy commit
[oweals/karmaworld.git] / export_env_to_heroku.py
1 import subprocess
2
3 def export_env(filename='.env'):
4     data=['heroku', 'config:set']
5     with open(filename, 'r') as config:
6         for line in config.readlines():
7             # ignore whitespace padding
8             line.strip()
9             tmp = line.split('=')
10             # further ignore whitespace padding that was around the =
11             tmp = map(str.strip, tmp)
12             # check for nonempty variable and content
13             if len(tmp) == 2 and len(tmp[0]) and len(tmp[1]):
14                 data.append('{0}={1}'.format(*tmp))
15     return subprocess.check_call(data)
16
17 if __name__ == '__main__':
18     import sys
19     sys.exit(export_env('.env.example'))