This repository has been archived by the owner on Nov 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup_heroku.py
23 lines (20 loc) · 1.57 KB
/
setup_heroku.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""This program will setup your environment variables for Heroku."""
import subprocess # Runs commands
import yaml
if __name__ == '__main__':
cmd = 'heroku config:set'
with open('config.yaml') as config_file:
CONFIG = yaml.load(config_file)
appname = '--app {}'.format(CONFIG['Heroku bot name'])
# Push all config vars to Heroku environment vars
temp = subprocess.call('{} API_KEY={} {}'.format(cmd, CONFIG['API Key'], appname), shell=True)
temp = subprocess.call('{} API_SECRET_KEY={} {}'.format(cmd, CONFIG['API Secret Key'], appname), shell=True)
temp = subprocess.call('{} ACCESS_TOKEN={} {}'.format(cmd, CONFIG['Access Token'], appname), shell=True)
temp = subprocess.call('{} ACCESS_TOKEN_SECRET={} {}'.format(cmd, CONFIG['Access Token Secret'], appname), shell=True)
temp = subprocess.call('{} LOG_NAME={} {}'.format(cmd, CONFIG['Target name in logs'], appname), shell=True)
temp = subprocess.call('{} TARGET={} {}'.format(cmd, CONFIG['Target account handle'], appname), shell=True)
temp = subprocess.call('{} URL_NUMBER={} {}'.format(cmd, CONFIG['Tweet URL location'], appname), shell=True)
temp = subprocess.call('{} WHERE={} {}'.format(cmd, CONFIG['Target image location on site'], appname), shell=True)
temp = subprocess.call('{} BOT={} {}'.format(cmd, CONFIG['Your account handle'], appname), shell=True)
# This one identifies if the bot is running locally or on Heroku
temp = subprocess.call('{} XKCD_APPNAME={} {}'.format(cmd, CONFIG['Heroku bot name'], appname), shell=True)