gatus
gatus copied to clipboard
split config files
Describe the feature request
Currently all config is in a single file
Splitting config into mutliple files can improve readability
for example : config/generic.yaml with all global config
metrics: true storage:
type: sqlite
path: data.db remote:
instances:
- endpoint-prefix: "Remonte Node~"
url: "http://8.8.8.8:8080/api/v1/endpoints/statuses"
config/host1.yaml with host1
- name: host1-ping
url: "icmp://host1"
conditions:
- "[CONNECTED] == true"
- name: host1-tcp6739
url: "tcp://host1:6739"
conditions:
- "[CONNECTED] == true"
Adding a notion of "service" can be great (so we can link a node with multiples services)
config/host1.yaml with host1
- name: host1
service : ping
url: "icmp://host1"
conditions:
- "[CONNECTED] == true"
service: redis
url: "tcp://host1:6739"
conditions:
- "[CONNECTED] == true"
Thanks !
Why do you personally want this feature to be implemented?
improve readability and maintainability
How long have you been using this project?
No response
Additional information
No response
Honestly, I'm not sure how I feel about that.
If you need more than one configuration file because you have too many lines, perhaps it's because there's too many endpoints for one Gatus instance.
While I do understand that configuration files can get rather large, with some comments, it shouldn't harm readability/maintainability, not to mention that you can leverage anchors to make your configs smaller.
For instance, in your example, you mentioned these:
endpoints:
- name: host1-ping
url: "icmp://host1"
conditions:
- "[CONNECTED] == true"
- name: host1-tcp6739
url: "tcp://host1:6739"
conditions:
- "[CONNECTED] == true"
- name: host1
url: "icmp://host1"
conditions:
- "[CONNECTED] == true"
- name: redis
url: "tcp://host1:6739"
conditions:
- "[CONNECTED] == true"
Well, you can shorten them like so:
default-endpoint: &default
conditions:
- "[CONNECTED] == true"
endpoints:
- name: host1-ping
url: "icmp://host1"
<<: *defaults
- name: host1-tcp6739
url: "tcp://host1:6739"
<<: *defaults
- name: host1
url: "icmp://host1"
<<: *defaults
- name: redis
url: "tcp://host1:6739"
<<: *defaults
The benefits are not that pronounced in the example above because the defaults are rather small, but it does add up.
Another of my concerns would also be that we'd now have to watch more files so that we can reload the application if they get updated.
I do understand where you're coming from, though, but I'm just not sure if this is something worth implementing right now.
👍
This would help in setting up the application on kubernetes. At the moment we're trying to add a postgres connection, however we want to store the sensitive part (username/password) in a secret instead of the configmap. Having the ability to split the config files would make this possible.
I'd also like to second the usefulness of managing this solution with split files. Our Gatus configuration file is over 1600 lines, and we anticipate needing to monitor more endpoints in the future. We can use the default condition syntax above, but it will still be quite lengthy.
I also think this would be useful and it's not just about the configuration file length, in k8s you might want to have the config for a specific service as a ConfigMap on that service's helm chart so each service manages its own monitoring config, the same way it would have its own PrometheusRules or Grafana dashboards...
Implemented by #396