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
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)
17 if __name__ == '__main__':
19 sys.exit(export_env('.env.example'))