any-env-and-bind-address #58
1 changed files with 2 additions and 4 deletions
|
@ -57,16 +57,14 @@ def perform_migration(cursor: sqlite3.Cursor, migration: tuple[int, str]) -> Non
|
||||||
def get_db_path() -> str | DBNotFoundError:
|
def get_db_path() -> str | DBNotFoundError:
|
||||||
'''Gets the DB path from config.ini'''
|
'''Gets the DB path from config.ini'''
|
||||||
env = os.environ.get('KEMOVERSE_ENV')
|
env = os.environ.get('KEMOVERSE_ENV')
|
||||||
if not (env and env in ['prod', 'dev']):
|
|
||||||
raise KemoverseEnvUnset
|
|
||||||
|
|
||||||
print(f'Running in "{env}" mode')
|
|
||||||
|
|
||||||
config_path = f'config_{env}.ini'
|
config_path = f'config_{env}.ini'
|
||||||
|
|
||||||
if not os.path.isfile(config_path):
|
if not os.path.isfile(config_path):
|
||||||
raise ConfigError(f'Could not find {config_path}')
|
raise ConfigError(f'Could not find {config_path}')
|
||||||
|
|
||||||
|
print(f'Running in "{env}" mode')
|
||||||
|
|
||||||
config = ConfigParser()
|
config = ConfigParser()
|
||||||
config.read(config_path)
|
config.read(config_path)
|
||||||
db_path = config['application']['DatabaseLocation']
|
db_path = config['application']['DatabaseLocation']
|
||||||
|
|
Loading…
Add table
Reference in a new issue