Documentation
¶
Overview ¶
Package config provides interactive configuration tools for GDG, including the TUI-driven plugin rekey workflow.
Index ¶
- func ClearContexts(app *config_domain.GDGAppConfiguration)
- func CopyContext(app *config_domain.GDGAppConfiguration, src, dest string)
- func CreateNewContext(app *config_domain.GDGAppConfiguration, name string, ...)
- func DefaultConfig() string
- func DeleteContext(app *config_domain.GDGAppConfiguration, name string, skipConfirmation bool)
- func DeleteS3Config(app *config_domain.GDGAppConfiguration, name string)
- func InitTemplateConfig(override string) *config_domain.TemplatingConfig
- func ListS3Configs(app *config_domain.GDGAppConfiguration) map[string]map[string]string
- func NewConfig(override string, opts ...config_domain.GDGAppConfigurationOption) *config_domain.GDGAppConfiguration
- func RunRekey(app *config_domain.GDGAppConfiguration, regClient *registry.Client) error
- func RunRekeyWithPlugin(app *config_domain.GDGAppConfiguration, regClient *registry.Client, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearContexts ¶ added in v0.9.1
func ClearContexts(app *config_domain.GDGAppConfiguration)
ClearContexts resets all contexts to a single default example context and saves the config.
func CopyContext ¶ added in v0.9.1
func CopyContext(app *config_domain.GDGAppConfiguration, src, dest string)
CopyContext Makes a copy of the specified context and write to disk
func CreateNewContext ¶ added in v0.9.1
func CreateNewContext(app *config_domain.GDGAppConfiguration, name string, registryClient *registry.Client)
CreateNewContext launches the 3-panel config builder TUI to interactively configure a new Grafana context. On successful completion it writes secure files, updates the context map, and saves the config to disk. registryClient is used to populate the optional cipher-plugin phases; pass a default-constructed client when no override is needed.
func DefaultConfig ¶ added in v0.9.1
func DefaultConfig() string
func DeleteContext ¶ added in v0.9.1
func DeleteContext(app *config_domain.GDGAppConfiguration, name string, skipConfirmation bool)
DeleteContext removes a given context and its associated credential files. When skipConfirmation is true, all credential files (except default.yaml) are deleted without prompting. Otherwise the user is asked to confirm deletion of each file. If the context references a storage engine that is no longer used by any other context, the user is also prompted to delete that engine and its credentials file.
func DeleteS3Config ¶ added in v0.9.3
func DeleteS3Config(app *config_domain.GDGAppConfiguration, name string)
DeleteS3Config removes a named storage engine from the config and cleans up its credentials file from the current context's secure location. It warns (but does not fail) if the engine is still referenced by an existing context.
func InitTemplateConfig ¶ added in v0.5.2
func InitTemplateConfig(override string) *config_domain.TemplatingConfig
InitTemplateConfig loads templating configuration from a file or defaults. It builds the search path, reads the config with Viper, and returns a populated *config_domain.TemplatingConfig instance.```
func ListS3Configs ¶ added in v0.9.3
func ListS3Configs(app *config_domain.GDGAppConfiguration) map[string]map[string]string
ListS3Configs returns all storage_engine entries from the config.
func NewConfig ¶ added in v0.9.3
func NewConfig(override string, opts ...config_domain.GDGAppConfigurationOption) *config_domain.GDGAppConfiguration
NewConfig initializes the global configuration from a file or defaults. It loads gdg.yml (or importer.yml) using Viper, updates context names, and stores the configuration in a global variable for later use.
func RunRekey ¶ added in v0.9.4
func RunRekey(app *config_domain.GDGAppConfiguration, regClient *registry.Client) error
RunRekey launches the interactive plugin re-key TUI for the provided app configuration. It builds the current (old) encoder, collects user choices, runs a dry-run scan for file preview, then executes migration and optionally updates gdg.yml.
regClient is used to fetch available cipher plugins from the registry. Pass nil to skip plugin selection (only "disable" will be available).
func RunRekeyWithPlugin ¶ added in v0.9.4
func RunRekeyWithPlugin( app *config_domain.GDGAppConfiguration, regClient *registry.Client, oldPlugin *config_domain.PluginEntity, newPlugin *config_domain.PluginEntity, initialContextNames []string, ) error
RunRekeyWithPlugin is like RunRekey but skips the plugin-selection phases because the caller has already collected the new plugin configuration (e.g. from the context-builder TUI). The TUI starts at phaseRekeyContextSelect so the user is only asked about which files to migrate, backup preferences, and whether to include the auth file — not which plugin to use.
oldPlugin is the PluginEntity that was active *before* the switch (may be nil if no plugin was previously configured or if it was disabled). A nil oldPlugin causes NoOpEncoder to be used, which is correct when existing files are stored as plaintext.
initialContextNames, if non-empty, seeds the context multi-select with the provided context names pre-checked. Callers should pass the names of contexts that existed before the current operation — this way the newly created context (which has no files yet) is not pre-selected. When empty, the active context from app.GetContext() is pre-selected.
Types ¶
This section is empty.