Files
Alloy/lib/std.alloy
Karolis2011 fa57353a6e Add Grafana Alloy configuration files and update examples
- Introduced detailed configuration guidelines in alloy.instructions.md
- Added general instructions for project structure in general.instructions.md
- Created config.yaml for NAMU-PC with target hostnames
- Implemented example.alloy and openwrt.alloy for service discovery and scraping
- Added alloy_seed.json for initial configuration state
- Developed demo.alloy for comprehensive monitoring setup
- Established std.alloy for repository path formatting and host configuration loading
- Updated test.alloy to utilize new host configuration loading
2025-08-01 16:25:31 +03:00

64 lines
1.6 KiB
Plaintext

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]
}
}