-
Notifications
You must be signed in to change notification settings - Fork 10
/
application_secrets.py
29 lines (25 loc) · 1 KB
/
application_secrets.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
class Secrets:
def __init__(self):
# NOTE: When adding RDS connection parameters, ensure that RDS is allowing connections from this IP address.
self.RDS_USERNAME = '' # Same as keepass
self.RDS_PASSWORD = '' # Same as keepass
self.RDS_HOSTNAME = '' # Instance endpoint
self.RDS_PORT = '' # Instance port
self.RDS_DB_NAME = '' # Instance configuration -> DB name
self.S3_ACCESS_KEY = '' # S3 username, keepass
self.S3_SECRET_ACCESS_KEY = '' # S3 password, keepass
self.SECRET_KEY = 'default' # CSRF secret key, keepass
def __bool__(self):
return self.RDS_DB_NAME != ''
def get_database_uri(self):
if self:
return 'mysql://{user}:{pswd}@{host}:{port}/{name}'.format(
user = self.RDS_USERNAME,
pswd = self.RDS_PASSWORD,
host = self.RDS_HOSTNAME,
port = self.RDS_PORT,
name = self.RDS_DB_NAME,
)
else:
return 'sqlite:///:memory:'
secrets = Secrets()