Documentation
¶
Index ¶
Constants ¶
const ( // AppName is the directory name used under the OS config dir. AppName = "gh-secrets-sync" // ConfigFileName is the name of the config file. ConfigFileName = "secrets.yaml" // EnvConfigFile is the environment variable that overrides the config file path. EnvConfigFile = "GH_SECRETS_SYNC_CONFIG_FILE" )
Variables ¶
This section is empty.
Functions ¶
func DefaultConfigPath ¶
DefaultConfigPath returns the OS-appropriate path for the secrets.yaml config file, using os.UserConfigDir() for cross-platform compatibility.
It checks for the GH_SECRETS_SYNC_CONFIG_FILE environment variable first.
Linux/macOS: ~/.config/gh-secrets-sync/secrets.yaml Windows: %APPDATA%\gh-secrets-sync\secrets.yaml
func EnsureConfigExists ¶
EnsureConfigExists checks whether the config file at path exists and creates it (along with any missing parent directories) if it does not.
The directory is created with 0700 permissions and the file with 0600 permissions. It returns true when the file was newly created and false when it already existed.
Types ¶
type Config ¶
type Config struct {
Secrets []Secret `yaml:"secrets"`
}
Config is the top-level structure of secrets.yaml.
func Load ¶
Load reads and parses the YAML config file at path. It returns a descriptive error (including the file path) when the file cannot be read or contains invalid YAML.
func (*Config) AddSecret ¶
AddSecret adds s to cfg. It returns an error if a secret with the same name already exists and force is false. When force is true the existing entry is overwritten in place (preserving its position in the slice).
func (*Config) DeleteSecret ¶
DeleteSecret removes the secret with the given name from cfg. It returns an error if no secret with that name exists.
func (*Config) UpdateSecret ¶
UpdateSecret updates an existing secret by name. Only non-zero fields in patch are applied: if patch.Value is non-empty it replaces the current value; if patch.Repositories is non-nil it replaces the current repo list, including with an explicit empty slice. Returns an error if no secret with the given name exists.