-
Notifications
You must be signed in to change notification settings - Fork 213
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
Add templating to porter config file #1879
Conversation
269d979
to
c387d58
Compare
c387d58
to
e3a4e20
Compare
Support templating in the Porter config file, e.g. ~/.porter/config.json|toml|yaml. The template syntax uses a yaml-friendly delimiiter, ${}. For example, ${env.NAME} or ${secret.NAME}. If you are using toml or json for your config file format, then you may need to use quotes around template values to ensure that the config file has valid syntax when it is loaded. We load the config file first with only environment variables substituted, then we initialize the secrets plugin, and finally do a second pass of the config file to replace any secrets. So that first pass needs to be a valid file based on the current format. For example, in a porter.toml file, secrets should be quoted: ```toml [[storage]] name = "dev" plugin = "mongodb" [storage.config] url = "${secret.connection-string}" ``` Only environment variables and secrets can be substituted. The secrets are resolved from the default secret storage. I am implementing this with the liquid template engine (from shopify that was ported to Go). I don't want us to commit to supporting liquid templates at this time, it's just an implementaiton detail that liquid is used at the moment and it could change later. Signed-off-by: Carolyn Van Slyck <[email protected]>
e3a4e20
to
dfeb0e7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Excited to use this new functionality 👏
docs/content/configuration.md
Outdated
# Defines storage accounts | ||
[[storage]] | ||
# The storage account name | ||
name = "cosmos" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should/can this be "devdb"
to match the default-storage
value above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops!
docs/content/configuration.md
Outdated
It is set with the PORTER_ALLOW_DOCKER_HOST_ACCESS environment variable. | ||
|
||
This flag is available for the following commands: install, upgrade], invoke, and uninstall. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This flag is available for the following commands: install, upgrade], invoke, and uninstall. | |
This flag is available for the following commands: install, upgrade, invoke, and uninstall. |
Signed-off-by: Carolyn Van Slyck <[email protected]>
/azp run porter-integration |
Azure Pipelines successfully started running 1 pipeline(s). |
What does this change
Support templating in the Porter config file, e.g.
~/.porter/config.json|toml|yaml.
The template syntax uses a yaml-friendly delimiiter, ${}. For example,
${env.NAME} or ${secret.NAME}. If you are using toml or json for your
config file format, then you may need to use quotes around template
values to ensure that the config file has valid syntax when it is
loaded.
We load the config file first with only environment variables
substituted, then we initialize the secrets plugin, and finally do a
second pass of the config file to replace any secrets. So that first
pass needs to be a valid file based on the current format.
For example, in a porter.toml file, secrets should be quoted:
Only environment variables and secrets can be substituted. The secrets
are resolved from the default secret storage.
I am implementing this with the liquid template engine (from shopify
that was ported to Go). I don't want us to commit to supporting liquid
templates at this time, it's just an implementation detail that liquid
is used at the moment and it could change later.
Preview of the config documentation at https://deploy-preview-1879--porter.netlify.app/configuration/
What issue does it fix
Closes #1763
Notes for the reviewer
Eventually porter.yaml will transition to this new template delimiter before v1.
Checklist
Reviewer Checklist