# README
stage: Create group: Code Review info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
Add a new configuration
To add a new configuration to config.yaml.lock
:
-
Add a head comment and a default value:
# head comment new_key: default_value
-
Add any configuration that is specific to a hostname or GitLab instance to the
hosts
section, in thegitlab.com
subsection:... # This configuration is specifically for GitLab instances hosts: gitlab.com: ... # This is a new config new_key: default_value ...
-
Add general configuration changes before the
hosts
section:... # Head comment new_key: default_value # Configuration specific for GitLab instances hosts: gitlab.com: ...
-
Run
make gen-config
orcd internal/config && go generate
. -
Most configuration keys can be overwritten by their corresponding environment variables. If the corresponding environment variable name differs from the configuration key's name, set the environment variable's name in the
config_mapping.go
file.
# Functions
CheckFileExists: checks if a file exists and is not a directory.
CheckPathExists checks if a folder exists and is a directory.
ConfigDir returns the config directory.
ConfigFile returns the config file path.
ConfigKeyEquivalence returns the equivalent key that's actually used in the config file.
EnvKeyEquivalence returns the equivalent key that's used for environment variables.
GetFromEnv is just a wrapper for os.GetEnv but checks for matching names used in previous glab versions and retrieves the value of the environment if any of the matching names have been set.
GetFromEnvWithSource works like GetFromEnv but also returns the name of the environment variable that was set as the source.
No description provided by the author
Init initialises and returns the cached configuration.
NewBlankConfig initializes a config file pre-populated with comments and default values.
No description provided by the author
No description provided by the author
NewFromString initializes a Config from a yaml string.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
WriteFile to the path If the path is smylink it will write to the symlink.
# Variables
BackupConfigFile creates a backup of the provided config file.
LocalConfigDir returns the local config path in map which must be joined for complete path.
LocalConfigFile returns the config file name with full path.
No description provided by the author
No description provided by the author
# Structs
No description provided by the author
No description provided by the author
ConfigMap type implements a low-level get/set config that is backed by an in-memory tree of YAML nodes.
HostConfig represents the configuration for a single host.
No description provided by the author
NotFoundError is returned when a config entry is not found.
# Interfaces
A Config reads and writes persistent configuration for glab.