Update env to remove secrets and add secrets to redis

This commit is contained in:
Dustin Pianalto 2019-12-23 20:51:40 -09:00
parent 8664bac978
commit 5e691b8dcf
4 changed files with 15 additions and 4 deletions

10
.env Normal file
View File

@ -0,0 +1,10 @@
REDIS_DB=0
REDIS_HOST=ip-10-0-0-4.ec2.internal
REDIS_PORT=6379
REDIS_PASSWORD=EUZ9QWkaFhMM
USE_DOCKER=yes
DISCORD_DEFAULT_PREFIX=g$
PYTHONPATH=/code:$PYTHONPATH

1
.gitignore vendored
View File

@ -331,6 +331,5 @@ geeksbot_v2/media/
.ipython/
.env
.envs/*
!.envs/.local/

View File

@ -85,4 +85,4 @@ async def on_ready():
with open(f'{bot.config_dir}restart', 'w') as f:
f.write('0')
bot.run(os.environ['TOKEN'])
bot.run(bot.token)

View File

@ -24,8 +24,10 @@ class Geeksbot(commands.Bot):
self.config_dir = 'geeksbot/config'
self.config_file = 'bot_config.json'
self.extension_dir = 'exts'
self.cache = redis.Redis(host=os.environ['REDIS_HOST'], port=os.environ['REDIS_PORT'], db=1, charset="utf-8", decode_responses=True)
self.api_token = os.environ['API_TOKEN']
self.cache = redis.Redis(host=os.environ['REDIS_HOST'], port=os.environ['REDIS_PORT'], db=os.environ['REDIS_DB'], charset="utf-8", decode_responses=True)
settings_cache = redis.Redis(host=os.environ['REDIS_HOST'], port=os.environ['REDIS_PORT'], db=1, charset="utf-8", decode_responses=True)
self.token = settings_cache.get('DISCORD_TOKEN')
self.api_token = settings_cache.get('API_TOKEN')
self.aio_session = aiohttp.ClientSession(loop=self.loop)
self.auth_header = {'Authorization': f'Token {self.api_token}'}
self.api_base = 'https://geeksbot.app/api'