any-env-and-bind-address #58
1 changed files with 4 additions and 0 deletions
|
@ -15,6 +15,10 @@ def get_config_file() -> str:
|
||||||
if not env:
|
if not env:
|
||||||
raise ConfigError('Error: KEMOVERSE_ENV is unset')
|
raise ConfigError('Error: KEMOVERSE_ENV is unset')
|
||||||
VD15 marked this conversation as resolved
Outdated
|
|||||||
|
|
||||||
|
# Validate environment name contains only alphanumeric, dash, and underscore
|
||||||
|
if not re.match(r'^[a-zA-Z0-9_-]+$', env):
|
||||||
|
raise ValueError(f'KEMOVERSE_ENV "{env}" contains invalid characters. Only alphanumeric, dash (-), and underscore (_) are allowed.')
|
||||||
|
|
||||||
config_path: str = f'config_{env}.ini'
|
config_path: str = f'config_{env}.ini'
|
||||||
|
|
||||||
if not path.isfile(config_path):
|
if not path.isfile(config_path):
|
||||||
|
|
Loading…
Add table
Reference in a new issue
We might want to remove this check from the database migration script as well, I think we have an identical one there: https://git.waifuism.life/waifu/kemoverse/src/branch/any-env-and-bind-address/setup_db.py#L60