Skip to content

Feature Request: Default Values #3

@filex

Description

@filex

I would like to define default values for replacements:

KEY={{ VALUE : default }}

especially for docker setups, where tg is used from the entrypoint, I imagine this to be more robust than defining all necessary env vars in docker-compose.yml. this would also eliminate the need to check for all variables from the tg called (entrypoint).

The other nice effect is, that default values can be defined in the target file.

Jinja defaults are quite cumbersome: {{ first_name|default("walter", true) }. therefore my proposal is more bash-oriented, where a default can be written as ${NAME:-walter}. the colon could have arbitrary whitespaces (see above) or we could define {{ VALUE:default }}. it doesn't really matter.

However, it would be handy to allow whitespaces in the default value without the need for quoting:

TITLE={{ PAGE_TITLE : Good news! }}

For processing I would suggest to read everything behind the colon and trim whitespaces.

@malud, what do you think?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions