Skip to content

Instantly share code, notes, and snippets.

@michaelNgiri
Created April 7, 2021 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelNgiri/3d2d79655bc2d338e75e446c3d96c48c to your computer and use it in GitHub Desktop.
Save michaelNgiri/3d2d79655bc2d338e75e446c3d96c48c to your computer and use it in GitHub Desktop.
import os
def removeQuotesFromValue(value):
value = value.replace("'", '"')
# value = value.replace('"', "")
return value
def splitLineIntoParts(line):
line = line.lstrip()
line = line.rstrip()
line = removeQuotesFromValue(line)
line = line.split("=", 1)
return line
def setConfigVar(name, value):
os.system('heroku config:set ' + name + '=' + value)
with open('.env') as e:
for line in e:
l = splitLineIntoParts(line)
if (len(l) > 1):
name = l[0]
value = l[1]
print()
print ("*** Setting " + name + " = " + value + " ***")
setConfigVar(name, value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment