forked from dwayn/aws-management-suite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample_settings.py
41 lines (33 loc) · 1.78 KB
/
sample_settings.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
30
31
32
33
34
35
36
37
38
39
40
41
__author__ = 'dwayn'
import os
def env(keys, dflt):
if isinstance(keys, basestring):
keys = [ keys ]
for key in keys:
if os.environ.has_key(key):
return os.environ.get(key)
return dflt
# All settings can be set via the environment or explicitly within this file. To give a setting the Python
# value of None via an environment variable, assign it the string 'None'
# The AWS credentials may be supplied as environment variables with either the standard AWS
# naming convention or with AWSMS-specific environment variable names
AWS_ACCESS_KEY = env(['AWSMS_AWS_ACCESS_KEY', 'AWS_ACCESS_KEY'], 'some_aws_access_key')
AWS_SECRET_KEY = env(['AWSMS_AWS_SECRET_KEY', 'AWS_SECRET_KEY'], 'some_aws_secret_key')
SSH_USER = env('AWSMS_SSH_USER', 'some_user')
SSH_PORT = env('AWSMS_SSH_PORT', 22)
# the credential settings for ssh/sudo below can be a string or None
SSH_PASSWORD = env('AWSMS_SSH_PASSWORD', 'some_password')
SSH_KEYFILE = env('AWSMS_SSH_KEYFILE', '~/.ssh/id_rsa.pub')
SUDO_PASSWORD = env('AWSMS_SUDO_PASSWORD', 'some_sudo_password')
TRACKING_DB = {
'host' : env('AWSMS_DB_HOST', 'localhost'),
'port' : env('AWSMS_DB_PORT', 3306),
'user' : env('AWSMS_DB_USER', 'ams_user'),
'pass' : env('AWSMS_DB_PASSWORD', 'some_db_password'),
'dbname' : env('AWSMS_DB_NAME', 'ams'),
}
# Turn the string "None" into None in password fields
SSH_PASSWORD = None if not SSH_PASSWORD or SSH_PASSWORD.lower() == 'none' else SSH_PASSWORD
SUDO_PASSWORD = None if not SUDO_PASSWORD or SUDO_PASSWORD.lower() == 'none' else SUDO_PASSWORD
# Expand '~' if it has been used to specify the ssh keyfile location
SSH_KEYFILE = None if not SSH_KEYFILE else os.path.expanduser(SSH_KEYFILE)