Working on Aether configs

This commit is contained in:
Scott Idem
2022-07-07 12:58:00 -04:00
parent cb2f8b05f0
commit 8598a39b1e
2 changed files with 42 additions and 8 deletions

View File

@@ -20,7 +20,7 @@ from app.log import log, logging
# Import the routers here first: # Import the routers here first:
from app.routers import api_crud, api, importing, sql, account, activity_log, address, archive, archive_content, contact, cont_edu_cert, cont_edu_cert_person, data_store, event, event_badge, event_badge_template, event_device, event_exhibit, event_exhibit_tracking, event_file, event_importing, event_location, event_person, event_person_detail, event_person_tracking, event_presentation, event_presenter, event_registration, event_session, flask_cfg, hosted_file, journal, journal_entry, log_client_viewing, lookup, membership_cfg, membership_group, membership_person_group, membership_person, membership_person_profile, membership_type, membership_person_type, order, order_v3, order_line, order_cart, organization, page, person, person_user, post, post_comment, product, qr, site, site_domain, user, websockets, e_cvent, c_idaa, e_impexium from app.routers import api_crud, api, importing, sql, account, activity_log, address, archive, archive_content, contact, cont_edu_cert, cont_edu_cert_person, data_store, event, event_badge, event_badge_template, event_device, event_exhibit, event_exhibit_tracking, event_file, event_importing, event_location, event_person, event_person_detail, event_person_tracking, event_presentation, event_presenter, event_registration, event_session, flask_cfg, hosted_file, journal, journal_entry, log_client_viewing, lookup, membership_cfg, membership_group, membership_person_group, membership_person, membership_person_profile, membership_type, membership_person_type, order, order_v3, order_line, order_cart, organization, page, person, person_user, post, post_comment, product, qr, site, site_domain, user, websockets, e_cvent, c_idaa, e_impexium
from app.db_sql import db from app.db_sql import db, sql_select
print('### **** *** ** * The Aether FastAPI API is loading... * ** *** **** ###') print('### **** *** ** * The Aether FastAPI API is loading... * ** *** **** ###')
@@ -34,16 +34,45 @@ print('### **** *** ** * The Aether FastAPI API is loading... * ** *** **** ###'
app = FastAPI( app = FastAPI(
title='Aether API', title = 'Aether API',
description='One Sky IT\'s Aether API using FastAPI.', description = 'One Sky IT\'s Aether API using FastAPI.',
version='5.7.0', version = '5.8.0',
operationsSorter='method', operationsSorter = 'method',
) )
@lru_cache() log.setLevel(logging.DEBUG)
def get_settings(): log.debug(config.settings)
return config.Settings() if aether_cfg_sql_result := sql_select(table_name='cfg', record_id=1, as_list=False, max_count=1):
aether_cfg_sql = aether_cfg_sql_result
# log.info(config.settings.APP_NAME)
log.debug(aether_cfg_sql_result.get('name'))
config.settings.test = 'test value for test'
config.settings.DB_SERVER = aether_cfg_sql.get('db_server')
config.settings.DB_PORT = aether_cfg_sql.get('db_port')
config.settings.DB_NAME = aether_cfg_sql.get('db_name')
config.settings.DB_USERNAME = aether_cfg_sql.get('db_username')
config.settings.DB_PASSWORD = aether_cfg_sql.get('db_password')
config.settings.SMTP['server'] = aether_cfg_sql.get('smtp_server')
config.settings.SMTP['port'] = aether_cfg_sql.get('smtp_port')
config.settings.SMTP['username'] = aether_cfg_sql.get('smtp_username')
config.settings.SMTP['password'] = aether_cfg_sql.get('smtp_password')
# config.settings.PATH_HOSTED_FILES_ROOT = aether_cfg_sql.get('PATH_HOSTED_FILES_ROOT')
# config.settings.PATH_HOSTED_TMP_ROOT = aether_cfg_sql.get('PATH_HOSTED_TMP_ROOT')
config.settings.FILES_PATH['hosted_files_root'] = aether_cfg_sql.get('path_hosted_files_root')
config.settings.FILES_PATH['hosted_tmp_root'] = aether_cfg_sql.get('path_hosted_tmp_root')
else:
# aether_cfg_sql_result
pass
# log.debug(aether_cfg_sql_result)
log.debug(config.settings)
# @lru_cache()
# def get_settings():
# return config.Settings()
app.mount('/static', StaticFiles(directory='static'), name='static') app.mount('/static', StaticFiles(directory='static'), name='static')

View File

@@ -32,10 +32,15 @@ async def get_qr(
n: str = Query('', max_length=100), n: str = Query('', max_length=100),
fn: str = Query('', max_length=100), fn: str = Query('', max_length=100),
title: str = Query('', max_length=100),
org: str = Query('', max_length=255), org: str = Query('', max_length=255),
url: str = Query('', max_length=500), url: str = Query('', max_length=500),
email: str = Query('', max_length=255), email: str = Query('', max_length=255),
tel: str = Query('', max_length=25), tel: str = Query('', max_length=25),
adr: str = Query('', max_length=200), adr: str = Query('', max_length=200),
adr_poa: str = Query('', max_length=100), # Address Post Office Address adr_poa: str = Query('', max_length=100), # Address Post Office Address
adr_ext: str = Query('', max_length=100), # Address Extended Address adr_ext: str = Query('', max_length=100), # Address Extended Address