Skip to content

Commit

Permalink
minor changes for aws
Browse files Browse the repository at this point in the history
  • Loading branch information
simsong committed Jan 15, 2025
1 parent 25487e2 commit e7c4084
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 2 additions & 4 deletions deploy/app/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from . import dbfile
from .constants import C
from .paths import DEFAULT_CREDENTIALS_FILE

COOKIE_MAXAGE = 60*60*24*180
SMTP_ATTRIBS = ['SMTP_USERNAME', 'SMTP_PASSWORD', 'SMTP_PORT', 'SMTP_HOST']
Expand All @@ -23,10 +24,7 @@


def credentials_file():
try:
name = os.environ[ C.PLANTTRACER_CREDENTIALS ]
except KeyError as e:
raise RuntimeError(f"Environment variable {C.PLANTTRACER_CREDENTIALS} must be defined") from e
name = os.environ.get(C.PLANTTRACER_CREDENTIALS,DEFAULT_CREDENTIALS_FILE)
if not os.path.exists(name):
logging.error("Cannot find %s (PLANTTRACER_CREDENTIALS=%s)",os.path.abspath(name),name)
raise FileNotFoundError(name)
Expand Down
3 changes: 2 additions & 1 deletion deploy/app/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
DEPLOY_DIR = dirname(APP_DIR)
ROOT_DIR = dirname(DEPLOY_DIR)

ETC_DIR = join(APP_DIR, 'etc')
ETC_DIR = join(DEPLOY_DIR, 'etc')
STATIC_DIR = join(APP_DIR, 'static')
TEMPLATE_DIR = join(APP_DIR, 'templates')
SCHEMA_FILE = join(ETC_DIR, 'schema.sql')
SCHEMA_TEMPLATE = join(ETC_DIR, 'schema_{schema}.sql')

DEFAULT_CREDENTIALS_FILE = join(ETC_DIR,'credentials.ini')
SCHEMA0_FILE = SCHEMA_TEMPLATE.format(schema=0)
SCHEMA1_FILE = SCHEMA_TEMPLATE.format(schema=1)

Expand Down

0 comments on commit e7c4084

Please sign in to comment.