Refactor load_config and load_host_config: streamline configuration loading and improve structure
This commit is contained in:
@@ -28,14 +28,8 @@ declare "fmt_repository_path" {
|
||||
}
|
||||
}
|
||||
|
||||
declare "load_host_config" {
|
||||
argument "host" {
|
||||
optional = true
|
||||
comment = "The host to load the configuration for"
|
||||
default = sys.env("GCLOUD_FM_COLLECTOR_ID")
|
||||
}
|
||||
|
||||
argument "config_file" {
|
||||
declare "load_config" {
|
||||
argument "config_file" {
|
||||
optional = false
|
||||
comment = "The path to the configuration file"
|
||||
}
|
||||
@@ -58,6 +52,34 @@ declare "load_host_config" {
|
||||
}
|
||||
|
||||
export "config" {
|
||||
value = encoding.from_yaml(remote.http.config_file.content)[argument.host.value]
|
||||
value = remote.http.config_file.content
|
||||
}
|
||||
}
|
||||
|
||||
declare "load_host_config" {
|
||||
argument "host" {
|
||||
optional = true
|
||||
comment = "The host to load the configuration for"
|
||||
default = sys.env("GCLOUD_FM_COLLECTOR_ID")
|
||||
}
|
||||
|
||||
argument "config_file" {
|
||||
optional = false
|
||||
comment = "The path to the configuration file"
|
||||
}
|
||||
|
||||
argument "repository" {
|
||||
optional = true
|
||||
comment = "The repository to use for loading the configuration"
|
||||
default = "https://git.kkarolis.lt/karolis/Alloy/"
|
||||
}
|
||||
|
||||
load_config "remote" {
|
||||
config_file = argument.config_file.value
|
||||
repository = argument.repository.value
|
||||
}
|
||||
|
||||
export "config" {
|
||||
value = encoding.from_yaml(load_config.remote.config)[argument.host.value]
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user