declare "fmt_repository_path" { argument "repository" { optional = true comment = "The repository to use for url" default = "https://git.kkarolis.lt/karolis/Alloy/" } argument "type" { optional = true comment = "Type of access to the repository, e.g. 'raw' for raw files" default = "raw" } argument "branch" { optional = true comment = "The branch to use for the repository" default = "main" } argument "path" { optional = false comment = "The path to the file in the repository" default = "" } export "url" { value = string.format("%s%s/branch/%s/%s", argument.repository.value, argument.type.value, argument.branch.value, argument.path.value) } } 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/" } fmt_repository_path "config_file_url" { repository = argument.repository.value type = "raw" branch = "main" path = argument.config_file.value } remote.http "config_file" { url = fmt_repository_path.config_file_url.url } export "config" { value = encoding.from_yaml(remote.http.config_file.content)[argument.host.value] } }