Worker: add JSON tags to config structs
Add JSON tags to the worker configuration structs. This way, the config is converted to JSON the same as it is to YAML, which is reflected in how the loaded configuration is logged at startup.
This commit is contained in:
parent
9cc7556720
commit
37b073b8d5
@ -47,17 +47,17 @@ var defaultConfig = WorkerConfig{
|
|||||||
// WorkerConfig represents the configuration of a single worker.
|
// WorkerConfig represents the configuration of a single worker.
|
||||||
// It does not include authentication credentials.
|
// It does not include authentication credentials.
|
||||||
type WorkerConfig struct {
|
type WorkerConfig struct {
|
||||||
WorkerName string `yaml:"worker_name"`
|
WorkerName string `yaml:"worker_name" json:"worker_name"`
|
||||||
|
|
||||||
// ConfiguredManager is the Manager URL that's in the configuration file.
|
// ConfiguredManager is the Manager URL that's in the configuration file.
|
||||||
ConfiguredManager string `yaml:"manager_url"`
|
ConfiguredManager string `yaml:"manager_url" json:"manager_url"`
|
||||||
|
|
||||||
// ManagerURL is the Manager URL to use by the Worker. It could come from the
|
// ManagerURL is the Manager URL to use by the Worker. It could come from the
|
||||||
// configuration file, but also from autodiscovery via UPnP/SSDP.
|
// configuration file, but also from autodiscovery via UPnP/SSDP.
|
||||||
ManagerURL string `yaml:"-"`
|
ManagerURL string `yaml:"-" json:"-"`
|
||||||
|
|
||||||
TaskTypes []string `yaml:"task_types"`
|
TaskTypes []string `yaml:"task_types" json:"task_types"`
|
||||||
RestartExitCode int `yaml:"restart_exit_code"`
|
RestartExitCode int `yaml:"restart_exit_code" json:"restart_exit_code"`
|
||||||
|
|
||||||
// LinuxOOMScoreAdjust controls the Linux out-of-memory killer. Is used when
|
// LinuxOOMScoreAdjust controls the Linux out-of-memory killer. Is used when
|
||||||
// spawning a sub-process, to adjust the likelyness that that subprocess is
|
// spawning a sub-process, to adjust the likelyness that that subprocess is
|
||||||
@ -69,12 +69,12 @@ type WorkerConfig struct {
|
|||||||
//
|
//
|
||||||
// If this value is not specified in the configuration file, Flamenco Worker
|
// If this value is not specified in the configuration file, Flamenco Worker
|
||||||
// will not attempt to adjust its OOM score.
|
// will not attempt to adjust its OOM score.
|
||||||
LinuxOOMScoreAdjust *int `yaml:"oom_score_adjust"`
|
LinuxOOMScoreAdjust *int `yaml:"oom_score_adjust" json:"oom_score_adjust"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type WorkerCredentials struct {
|
type WorkerCredentials struct {
|
||||||
WorkerID string `yaml:"worker_id"`
|
WorkerID string `yaml:"worker_id" json:"worker_id"`
|
||||||
Secret string `yaml:"worker_secret"`
|
Secret string `yaml:"worker_secret" json:"worker_secret"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// FileConfigWrangler is the default config wrangler that actually reads & writes files.
|
// FileConfigWrangler is the default config wrangler that actually reads & writes files.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user