Open
Conversation
Signed-off-by: alex <alex@alex-tuxedoinfinitybooks1517gen7>
Signed-off-by: Alex <al-git001@none.at>
amejia1
reviewed
Jan 31, 2026
| use anyhow::bail; | ||
| use std::env; | ||
|
|
||
| pub fn lookup_env_value(conf_string: String) -> anyhow::Result<String> { |
Contributor
There was a problem hiding this comment.
This can be done cleaner with the regex crate, see here for example.
amejia1
reviewed
Jan 31, 2026
| use std::env; | ||
|
|
||
| pub fn lookup_env_value(conf_string: String) -> anyhow::Result<String> { | ||
| if !conf_string.contains("{env:") { |
Contributor
There was a problem hiding this comment.
Ferron config files look a lot like caddy config files. How about using the same syntax like the caddyfile "env" placeholders? See https://caddyserver.com/docs/conventions#placeholders .
amejia1
reviewed
Jan 31, 2026
| } | ||
| } | ||
|
|
||
| #[cfg(test)] |
Contributor
There was a problem hiding this comment.
There should be a way to escape the placeholder, for example \{env.HOME} should render {env.HOME}.
amejia1
reviewed
Jan 31, 2026
| for kdl_entry in kdl_node.iter() { | ||
| let value = match kdl_entry.value().to_owned() { | ||
| KdlValue::String(value) => ServerConfigurationValue::String(value), | ||
| KdlValue::String(value) => { |
Contributor
There was a problem hiding this comment.
It will probably be best to render all placeholders first and then process the config files. Will this config work?
{env.HTTP_ADDRESS} {
proxy "http://localhost:3000/" // Replace "http://localhost:3000" with the backend server URL
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi @DorianNiemiecSVRJS!
I've created this PR as a follow up of the discussion on issue #233 and the PR #236 .
I tried to follow the style of the previous PR on lookup_env_var.rs with the addition of:
I appreciate any feedback.
Thanks in advance.