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

Env variables substitution in services' URI in config file #438

Closed
tony-sol opened this issue Feb 23, 2024 · 0 comments · Fixed by #439
Closed

Env variables substitution in services' URI in config file #438

tony-sol opened this issue Feb 23, 2024 · 0 comments · Fixed by #439

Comments

@tony-sol
Copy link
Contributor

Is your feature request related to a problem? Please describe.
I want to make a distributable podman-tui config, which will relate to bundled env variables, but services' URI read from config file as is, so only full path required.
That's why it's not possible to replace this

[services]
  [services.localhost]
    default = true
    uri = "unix:///Users/tony/.local/share/containers/podman/machine/qemu/podman.sock"

with this

[services]
  [services.localhost]
    default = true
    uri = "unix://${XDG_DATA_HOME}/containers/podman/machine/qemu/podman.sock"

Describe the solution you'd like
Here

func (c *Config) readConfigFromFile(path string) error {
log.Debug().Msgf("config: reading configuration file %q", path)
c.mu.Lock()
defer c.mu.Unlock()
meta, err := toml.DecodeFile(path, c)
if err != nil {
return fmt.Errorf("config: %w decode configuration %q", err, path)
}
keys := meta.Undecoded()
if len(keys) > 0 {
log.Debug().Msgf("config: failed to decode the keys %q from %q.", keys, path)
}
return nil
}

add env variable substitution

Additional context
Add any other context or screenshots about the feature request here.
Nope

navidys added a commit that referenced this issue Feb 24, 2024
resolves #438 Substitute env variables in config file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant