AB#2064 Feat/config/dev config to config (#139)

Renamed dev-config to config, additionally changed cdbg config to yaml.
This commit is contained in:
Fabian Kammel 2022-05-13 11:56:43 +02:00 committed by GitHub
parent fde7304d78
commit 83857b142c
20 changed files with 175 additions and 189 deletions

View file

@ -11,15 +11,15 @@ import (
// CDBGConfig describes the constellation-cli config file and extends it with a new field "cdbg".
type CDBGConfig struct {
ConstellationDebugConfig ConstellationDebugdConfig `json:"cdbg"`
configc.Config ``
ConstellationDebugConfig ConstellationDebugdConfig `yaml:"cdbg"`
configc.Config
}
// ConstellationDebugdConfig is the cdbg specific configuration.
type ConstellationDebugdConfig struct {
AuthorizedKeys []ssh.SSHKey `json:"authorized_keys"`
CoordinatorPath string `json:"coordinator_path"`
SystemdUnits []deploy.SystemdUnit `json:"systemd_units,omitempty"`
AuthorizedKeys []ssh.SSHKey `yaml:"authorizedKeys"`
CoordinatorPath string `yaml:"coordinatorPath"`
SystemdUnits []deploy.SystemdUnit `yaml:"systemdUnits,omitempty"`
}
// Default returns a struct with the default config.
@ -42,7 +42,7 @@ func FromFile(fileHandler file.Handler, name string) (*CDBGConfig, error) {
return conf, nil
}
if err := fileHandler.ReadJSON(name, conf); err != nil {
if err := fileHandler.ReadYAML(name, conf); err != nil {
return nil, fmt.Errorf("could not load config from file %s: %w", name, err)
}
return conf, nil