mirror of
https://github.com/Tech-Workers-Coalition-Italia/mobilizon-reshare.git
synced 2025-02-20 21:50:51 +01:00
* mobilizon_bots/cli.py: New file. * mobilizon_bots/config.py: Minor tweaks. * mobilizon_bots/settings.toml: Downcase variables, drop jinja2 templating in favor of format, add logging configuration.
36 lines
1.3 KiB
Python
36 lines
1.3 KiB
Python
from dynaconf import Dynaconf, Validator
|
|
|
|
settings = Dynaconf(
|
|
environments=True,
|
|
envvar_prefix="MOBILIZON_BOTS",
|
|
settings_files=[
|
|
"mobilizon_bots/settings.toml",
|
|
"mobilizon_bots/.secrets.toml",
|
|
"/etc/mobilizon_bots.toml",
|
|
"/etc/mobilizon_bots_secrets.toml",
|
|
],
|
|
validators=[
|
|
# Ensure some parameters exists (are required)
|
|
Validator("local_state_dir", "log_dir", "db_path", must_exist=True),
|
|
# Ensure some parameter mets a condition
|
|
# conditions: (eq, ne, lt, gt, lte, gte, identity, is_type_of, is_in, is_not_in)
|
|
Validator("local_state_dir", "log_dir", "db_path", is_type_of=str),
|
|
# check file or directory
|
|
# validate a value is eq in specific env
|
|
# Validator('PROJECT', eq='hello_world', env='production'),
|
|
#
|
|
# # Ensure some parameter (string) meets a condition
|
|
# # conditions: (len_eq, len_ne, len_min, len_max, cont)
|
|
# # Determines the minimum and maximum length for the value
|
|
# Validator("NAME", len_min=3, len_max=125),
|
|
#
|
|
# # Signifies the presence of the value in a set, text or word
|
|
# Validator("DEV_SERVERS", cont='localhost'),
|
|
#
|
|
# # Checks whether the length is the same as defined.
|
|
# Validator("PORT", len_eq=4),
|
|
],
|
|
)
|
|
|
|
settings.validators.validate()
|