Skip to content

Commit

Permalink
fix: move prometheus validation stanza to local schema
Browse files Browse the repository at this point in the history
Add prometheus config validation stanza to local
.schema/config.schema.json file
  • Loading branch information
claudio-benfatto committed May 14, 2020
1 parent 2734906 commit 99f9fb3
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .schema/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1062,6 +1062,35 @@
"$ref": "#/definitions/tlsx"
}
}
},
"prometheus": {
"type": "object",
"title": "Prometheus scraping endpoint",
"additionalProperties": false,
"properties": {
"port": {
"type": "integer",
"default": 9000,
"title": "Port",
"description": "The port to listen on."
},
"host": {
"type": "string",
"default": "",
"examples": [
"localhost",
"127.0.0.1"
],
"title": "Host",
"description": "The network interface to listen on. Leave empty to listen on all interfaces."
},
"metrics_path": {
"type": "string",
"default": "/metrics",
"title": "Path",
"description": "The path to provide metrics on"
}
}
}
}
},
Expand Down
5 changes: 5 additions & 0 deletions driver/configuration/provider_viper_public_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ func TestViperProvider(t *testing.T) {
assert.Equal(t, "127.0.0.1:1234", p.ProxyServeAddress())
assert.Equal(t, "127.0.0.2:1235", p.APIServeAddress())

t.Run("group=prometheus", func(t *testing.T) {
assert.Equal(t, "localhost:9000", p.PrometheusServeAddress())
assert.Equal(t, "/metrics", p.PrometheusMetricsPath())
})

t.Run("group=cors", func(t *testing.T) {
assert.True(t, p.CORSEnabled("proxy"))
assert.True(t, p.CORSEnabled("api"))
Expand Down
5 changes: 5 additions & 0 deletions internal/config/.oathkeeper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ serve:
path: /path/to/cert.pem
base64: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tXG5NSUlEWlRDQ0FrMmdBd0lCQWdJRVY1eE90REFOQmdr...

prometheus:
port: 9000
host: localhost
metrics_path: /metrics

# Configures Access Rules
access_rules:
# Locations (list of URLs) where access rules should be fetched from on boot.
Expand Down

0 comments on commit 99f9fb3

Please sign in to comment.