mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-09-24 14:58:35 -04:00
AB#2327 move debugd code into internal folder (#403)
* move debugd code into internal folder * Fix paths in CMakeLists.txt Signed-off-by: Fabian Kammel <fk@edgeless.systems>
This commit is contained in:
parent
708c6e057e
commit
5b40e0cc77
25 changed files with 31 additions and 31 deletions
35
debugd/internal/cdbg/config/config.go
Normal file
35
debugd/internal/cdbg/config/config.go
Normal file
|
@ -0,0 +1,35 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
|
||||
"github.com/edgelesssys/constellation/debugd/internal/debugd/deploy"
|
||||
configc "github.com/edgelesssys/constellation/internal/config"
|
||||
"github.com/edgelesssys/constellation/internal/file"
|
||||
)
|
||||
|
||||
// CDBGConfig describes the constellation-cli config file.
|
||||
type CDBGConfig struct {
|
||||
ConstellationDebugConfig ConstellationDebugdConfig `yaml:"cdbg"`
|
||||
}
|
||||
|
||||
// ConstellationDebugdConfig is the cdbg specific configuration.
|
||||
type ConstellationDebugdConfig struct {
|
||||
AuthorizedKeys []configc.UserKey `yaml:"authorizedKeys"`
|
||||
BootstrapperPath string `yaml:"bootstrapperPath"`
|
||||
SystemdUnits []deploy.SystemdUnit `yaml:"systemdUnits,omitempty"`
|
||||
}
|
||||
|
||||
// FromFile reads a debug configuration.
|
||||
func FromFile(fileHandler file.Handler, name string) (*CDBGConfig, error) {
|
||||
conf := &CDBGConfig{}
|
||||
if err := fileHandler.ReadYAML(name, conf); err != nil {
|
||||
if errors.Is(err, fs.ErrNotExist) {
|
||||
return nil, fmt.Errorf("%s not found - consult the README on how to setup cdbg", name)
|
||||
}
|
||||
return nil, fmt.Errorf("loading config from file %s: %w", name, err)
|
||||
}
|
||||
return conf, nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue