Ghost v2.1.0 is released with configuration support through CLI flags or a config file.

Configuration is supported for host, default model, and system prompt. All are optional with host and model having defaults.

The config file is located at ~/.config/ghost/config.toml.

ghost help command

I used urfave/alt-src for reading a config file since I am already using urfave/cli. Again it was a lot less config than with Viper.

alt-src uses a Sourcer struct for reading config files from JSON, YAML, or TOML.

load config function

From there you just add the Sourcer as a source for the flag. alt-src will chain it in priority after a flag passed by CLI.

initializing flags

You can get the value of flags using cmd.String(<flag name>).

calling flags