-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.py
More file actions
50 lines (36 loc) · 1.58 KB
/
settings.py
File metadata and controls
50 lines (36 loc) · 1.58 KB
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
42
43
44
45
46
47
48
49
50
import json
import os
USE_PARAMETER_STORE = os.getenv('USE_PARAMETER_STORE', False)
S3_BUCKET_NAME = os.getenv('S3_BUCKET_NAME')
S3_ROOT_DIR = 'EDITRADEOUT/002113/' # S3 paths do not start with a leading /
FTP_HOST = os.getenv('FTP_HOST', 'ftphost.editrade.com')
EDITRADE_FTP_USERNAME = os.getenv('EDITRADE_FTP_USERNAME')
EDITRADE_FTP_PASSWORD = os.getenv('EDITRADE_FTP_PASSWORD')
FTP_ROOT_DIR = os.getenv('FTP_ROOT_DIR', '/Usr/macship/EDITRADEOUT/002113/')
FTP_PORT = int(os.getenv('FTP_PORT', 22))
CHUNK_SIZE = 6291456
GOOGLE_SHEET_NAME = os.getenv('GOOGLE_SHEET_NAME', 'MAC - AMAZON CUSTOMS SYNC')
GOOGLE_WORKSHEET_NAME = 'RAW DATA - DO NOT EDIT'
GOOGLE_SERVICE_ACCOUNT_CREDENTIAL_JSON = json.loads(os.getenv('GOOGLE_SERVICE_ACCOUNT_CREDENTIAL_JSON', '{}'))
# Low effort way to use parameter store only in prod
if USE_PARAMETER_STORE:
import boto3
client = boto3.client('ssm', region_name='us-east-1')
def get_secret(key):
resp = client.get_parameter(
Name=key,
WithDecryption=True
)
return resp['Parameter']['Value']
EDITRADE_FTP_USERNAME = get_secret('EDITRADE_FTP_USERNAME')
EDITRADE_FTP_PASSWORD = get_secret('EDITRADE_FTP_PASSWORD')
GOOGLE_SERVICE_ACCOUNT_CREDENTIAL_JSON = json.loads(get_secret('GOOGLE_SERVICE_ACCOUNT_CREDENTIAL_JSON'))
SENTRY_DSN = get_secret('SENTRY_DSN')
if SENTRY_DSN:
import sentry_sdk
from sentry_sdk.integrations.aws_lambda import \
AwsLambdaIntegration
sentry_sdk.init(
SENTRY_DSN,
integrations=[AwsLambdaIntegration()]
)