fietsboek.config module¶
Configuration parsing for Fietsboek.
Fietsboek mostly relies on pyramid’s INI parsing to get its configuration,
however, there are quite a a few custom values that we add/need. Instead of
manually sprinkling settings.get(...) all over the code, we’d rather just
do it once at application startup, make sure that the values are well-formed,
provide the user with good feedback if they aren’t, and set the default values
in a single place.
Most of the logic is handled by pydantic.
- class fietsboek.config.Config(**data)¶
Bases:
BaseModelObject representing the Fietsboek configuration.
- available_locales: Annotated[list, BeforeValidator(func=_validate_pyramid_list, json_schema_input_type=PydanticUndefined)]¶
Available locales.
- default_tile_layers: Annotated[list, BeforeValidator(func=_validate_pyramid_list, json_schema_input_type=PydanticUndefined)]¶
The subset of the default tile layers that should be enabled.
By default, that’s all of them.
- derive_secret(what_for)¶
Derive a secret for other parts of the application.
All secrets are derived from
secret_keyin a deterministic way. See https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/security.html#admonishment-against-secret-sharing on whysecret_keyshould not be used directly.
- email_password: SecretStr¶
SMTP password (optional).
- hittekaart_autogenerate: Annotated[list, BeforeValidator(func=_validate_pyramid_list, json_schema_input_type=PydanticUndefined)]¶
Overlay maps to automatically generate.
- hittekaart_threads: int¶
Number of threads that hittekaart should use.
Defaults to 0, which makes it use as many threads as there are CPU cores.
- language_packs: Annotated[list, BeforeValidator(func=_validate_pyramid_list, json_schema_input_type=PydanticUndefined)]¶
Additional language packs to load.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- pages: Annotated[list, BeforeValidator(func=_validate_pyramid_list, json_schema_input_type=PydanticUndefined)]¶
Custom pages.
- public_tile_layers()¶
Returns all tile layer configs that are public.
- Return type:
- Returns:
A list of public :class:`TileLayerConfig`s.
- stamen_maps: Annotated[list, BeforeValidator(func=_validate_pyramid_list, json_schema_input_type=PydanticUndefined)]¶
Enabled stamen maps.
- thunderforest_access: LayerAccess¶
Thunderforest access restriction.
- thunderforest_key: SecretStr¶
API key for the Thunderforest integration.
- thunderforest_maps: Annotated[list, BeforeValidator(func=_validate_pyramid_list, json_schema_input_type=PydanticUndefined)]¶
List of enabled Thunderforest maps.
- tile_layers: list[TileLayerConfig]¶
Tile layers.
- class fietsboek.config.LayerAccess(*values)¶
Bases:
EnumEnum discerning whether a layer is publicly accessible or restriced to logged-in users.
Note that in the future, a finer-grained distinction might be possible.
- PUBLIC = 'public'¶
- RESTRICTED = 'restricted'¶
- class fietsboek.config.LayerType(*values)¶
Bases:
EnumEnum to distinguish base layers and overlay layers.
- BASE = 'base'¶
- OVERLAY = 'overlay'¶
- class fietsboek.config.TileLayerConfig(**data)¶
Bases:
BaseModelObject representing a single tile layer.
- access: LayerAccess¶
Layer access restriction.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- url: AnyUrl¶
URL of the layer tiles (with placeholders).