Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support default values in placeholders #5275

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Commits on Feb 7, 2023

  1. Support default values in placeholders

    Support variable expansion also in placeholders, like in
    `{unsetPlaceholder:default value}`. Implemented similarly to caddyserver#3682,
    which provided defaults for environment variable expansion.
    
    Closes caddyserver#1793.
    
    Signed-off-by: Jens Erat <jens.erat@mercedes-benz.com>
    JensErat committed Feb 7, 2023
    Configuration menu
    Copy the full SHA
    c4b6f23 View commit details
    Browse the repository at this point in the history
  2. remove optimization that breaks unescaping closing braces

    If we have a string `\}`, we'd expect this to be interpreted as `}`, similar to how `\}\{` would be interpreted as `}{`. If we optimize early by searching for opening braces, we'd not strip the escape character here.
    
    Signed-off-by: Jens Erat <jens.erat@mercedes-benz.com>
    JensErat committed Feb 7, 2023
    Configuration menu
    Copy the full SHA
    ee5fdb5 View commit details
    Browse the repository at this point in the history
  3. rewrite placeholder parser

    The old parser logic was quite complicated and does not support nested placeholder evaluation for defaults, as does not support counting closing braces.
    
    I assume the given approach using two loops and switch statements is more readable, and changes braces matching behavior to support nested defaulting provided in another commit.
    
    Signed-off-by: Jens Erat <jens.erat@mercedes-benz.com>
    JensErat committed Feb 7, 2023
    Configuration menu
    Copy the full SHA
    f2a925a View commit details
    Browse the repository at this point in the history
  4. support nested placeholder defaults

    Signed-off-by: Jens Erat <jens.erat@mercedes-benz.com>
    JensErat committed Feb 7, 2023
    Configuration menu
    Copy the full SHA
    e3d0e54 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    dc5c1ac View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    f3c560d View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    5f91215 View commit details
    Browse the repository at this point in the history
  8. linter fixes

    JensErat committed Feb 7, 2023
    Configuration menu
    Copy the full SHA
    83f0005 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    2d8fba4 View commit details
    Browse the repository at this point in the history

Commits on Feb 8, 2023

  1. Configuration menu
    Copy the full SHA
    66aae70 View commit details
    Browse the repository at this point in the history