Skip to content

Separate placeholders in ENV config #108

@tomschr

Description

@tomschr

Situation

Inside the ENV config, we have two types of potential placeholders:

  • Regular/config placeholders Syntax {placeholder}
    They are used to reference other parts of the ENV configuration. For example, if you have "{tmp_base_dir}/doc-example-com" as string, the placeholder tmp_base_dir is searched in the current section of the config.
    It's possible to refer to other sections of the config with section.key like in paths.base_tmp_dir.
    Whatever variation we use, at the end it should resolve to at least some path that can be accessed.

  • Runtime/dynamic placeholders Syntax {{placeholder}}
    These types of placeholders cannot and must not be replaced. They are replaced at runtime with specific values.

At the moment, some key contains both kind of placeholders. This is unfortunate as you can't test regular placeholders when they are mixed with runtime ones.

Use Case

Having these two separated have some benefits:

  • Both types are separated. For regular placeholders, it's the type EnsureWritableDirectory which tests the directory, permissions etc. This wouldn't be possible, if we would have a mixture of regular and dynamic types.

  • Code and testing becomes much more easier.

Possible Implementation

  1. Identify which keys uses both placeholder types.
  2. Introduce a consistent naming scheme (for example _dyn for dynamic content)
  3. Search the code that uses the key. Retrieve the dynamic key from the config and add it to the regular key to get the same functionality.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions