Add GATUS_CONFIG_FILE env var to support custom config path
This commit is contained in:
parent
6b30125a78
commit
16837562ea
@ -10,6 +10,10 @@ Live example: https://status.twinnation.org/
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
By default, the configuration file is expected to be at `config/config.yaml`.
|
||||||
|
|
||||||
|
You can specify a custom path by setting the `GATUS_CONFIG_FILE` environment variable.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
metrics: true # Whether to expose metrics at /metrics
|
metrics: true # Whether to expose metrics at /metrics
|
||||||
services:
|
services:
|
||||||
|
6
main.go
6
main.go
@ -25,10 +25,10 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func loadConfiguration() *config.Config {
|
func loadConfiguration() *config.Config {
|
||||||
args := os.Args
|
|
||||||
var err error
|
var err error
|
||||||
if len(args) == 2 {
|
customConfigFile := os.Getenv("GATUS_CONFIG_FILE")
|
||||||
err = config.Load(args[1])
|
if len(customConfigFile) > 0 {
|
||||||
|
err = config.Load(customConfigFile)
|
||||||
} else {
|
} else {
|
||||||
err = config.LoadDefaultConfiguration()
|
err = config.LoadDefaultConfiguration()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user