containers/podman-tui

Env variables substitution in services' URI in config file

Closed this issue · 0 comments

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