emissary/internal/config/agent.go

85 lines
2.4 KiB
Go

package config
type AgentConfig struct {
ServerURL InterpolatedString `yaml:"serverUrl"`
PrivateKeyPath InterpolatedString `yaml:"privateKeyPath"`
ReconciliationInterval InterpolatedInt `yaml:"reconciliationInterval"`
Controllers ControllersConfig `yaml:"controllers"`
Collectors []ShellCollectorConfig `yaml:"collectors"`
}
type ShellCollectorConfig struct {
Name InterpolatedString `yaml:"name"`
Command InterpolatedString `yaml:"command"`
Args InterpolatedStringSlice `yaml:"args"`
}
type ControllersConfig struct {
Persistence PersistenceControllerConfig `yaml:"persistence"`
Spec SpecControllerConfig `yaml:"spec"`
Gateway GatewayControllerConfig `yaml:"gateway"`
UCI UCIControllerConfig `yaml:"uci"`
App AppControllerConfig `yaml:"app"`
}
type PersistenceControllerConfig struct {
Enabled InterpolatedBool `yaml:"enabled"`
StateFile InterpolatedString `yaml:"stateFile"`
}
type SpecControllerConfig struct {
Enabled InterpolatedBool `yaml:"enabled"`
}
type GatewayControllerConfig struct {
Enabled InterpolatedBool `yaml:"enabled"`
}
type UCIControllerConfig struct {
Enabled InterpolatedBool `yaml:"enabled"`
BinPath InterpolatedString `yaml:"binPath"`
ConfigBackupFile InterpolatedString `yaml:"configBackupFile"`
}
type AppControllerConfig struct {
Enabled InterpolatedBool `yaml:"enabled"`
DataDir InterpolatedString `yaml:"dataDir"`
DownloadDir InterpolatedString `yaml:"downloadDir"`
}
func NewDefaultAgentConfig() AgentConfig {
return AgentConfig{
ServerURL: "http://127.0.0.1:3000",
PrivateKeyPath: "agent-key.json",
ReconciliationInterval: 5,
Controllers: ControllersConfig{
Spec: SpecControllerConfig{
Enabled: true,
},
Persistence: PersistenceControllerConfig{
Enabled: true,
StateFile: "state.json",
},
Gateway: GatewayControllerConfig{
Enabled: true,
},
UCI: UCIControllerConfig{
Enabled: true,
ConfigBackupFile: "uci-backup.conf",
BinPath: "uci",
},
App: AppControllerConfig{
Enabled: true,
DataDir: "apps/data",
DownloadDir: "apps/bundles",
},
},
Collectors: []ShellCollectorConfig{
{
Name: "uname",
Command: "uname",
Args: []string{"-a"},
},
},
}
}