emissary/internal/config/agent.go

85 lines
2.4 KiB
Go
Raw Permalink Normal View History

2023-02-02 10:55:24 +01:00
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"`
2023-02-02 10:55:24 +01:00
}
type ControllersConfig struct {
Persistence PersistenceControllerConfig `yaml:"persistence"`
Spec SpecControllerConfig `yaml:"spec"`
Gateway GatewayControllerConfig `yaml:"gateway"`
UCI UCIControllerConfig `yaml:"uci"`
App AppControllerConfig `yaml:"app"`
2023-02-02 10:55:24 +01:00
}
type PersistenceControllerConfig struct {
Enabled InterpolatedBool `yaml:"enabled"`
StateFile InterpolatedString `yaml:"stateFile"`
}
type SpecControllerConfig struct {
Enabled InterpolatedBool `yaml:"enabled"`
2023-02-02 10:55:24 +01:00
}
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"`
}
2023-02-02 10:55:24 +01:00
func NewDefaultAgentConfig() AgentConfig {
return AgentConfig{
ServerURL: "http://127.0.0.1:3000",
PrivateKeyPath: "agent-key.json",
2023-02-02 10:55:24 +01:00
ReconciliationInterval: 5,
Controllers: ControllersConfig{
Spec: SpecControllerConfig{
Enabled: true,
2023-02-02 10:55:24 +01:00
},
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",
},
2023-02-02 10:55:24 +01:00
},
Collectors: []ShellCollectorConfig{
{
Name: "uname",
Command: "uname",
Args: []string{"-a"},
},
},
2023-02-02 10:55:24 +01:00
}
}