Skip to content

Commit

Permalink
fix: Schema fixed to allow TLS key & cert as well as CORS max_age con…
Browse files Browse the repository at this point in the history
…figuration (#122)
  • Loading branch information
dadrus authored Jul 29, 2022
1 parent 1d0e8bb commit 58b6bc3
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 10 deletions.
74 changes: 72 additions & 2 deletions internal/config/test_data/test_config.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,92 @@
serve:
api:
host: 127.0.0.1
port: 4468
verbose_errors: true
timeout:
read: 2s
write: 5s
idle: 2m
cors:
allowed_origins:
- example.org
allowed_methods:
- GET
- POST
allowed_headers:
- Authorization
exposed_headers:
- X-My-Header
allow_credentials: true
max_age: 1m
tls:
key: /path/to/key/file.pem
cert: /path/to/cert/file.pem
trusted_proxies:
- 0.0.0.0/0
- 192.168.1.0/24

proxy:
host: 127.0.0.1
port: 4469
verbose_errors: false
timeout:
read: 2s
write: 5s
idle: 2m
cors:
allowed_origins:
- example.org
allowed_methods:
- GET
- POST
allowed_headers:
- Authorization
exposed_headers:
- X-My-Header
allow_credentials: true
max_age: 1m
tls:
key: /path/to/key/file.pem
cert: /path/to/cert/file.pem
trusted_proxies:
- 0.0.0.0/0
- 192.168.1.0/24

management:
host: 127.0.0.1
port: 4457
verbose_errors: false
timeout:
read: 2s
write: 5s
idle: 2m
cors:
allowed_origins:
- example.org
allowed_methods:
- GET
- POST
allowed_headers:
- Authorization
exposed_headers:
- X-My-Header
allow_credentials: true
max_age: 1m
tls:
key: /path/to/key/file.pem
cert: /path/to/cert/file.pem

log:
level: debug
format: text

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

tracing:
service_name: heimdall
provider: jaeger

pipeline:
Expand Down Expand Up @@ -103,6 +172,7 @@ pipeline:
payload: https://bla.bar
forward_response_headers_to_upstream:
- bla-bar
script: "throw 'foobar'"
- id: attributes_based_authorizer
type: local
config:
Expand Down
2 changes: 1 addition & 1 deletion internal/config/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func TestValidateConfigFileWithValidYAMLContentButFailingSchemaValidation(t *tes
func TestValidateValidConfigFile(t *testing.T) {
t.Parallel()

err := ValidateConfig("../../test_config.yaml")
err := ValidateConfig("./test_data/test_config.yaml")

require.NoError(t, err)
}
18 changes: 11 additions & 7 deletions schema/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,15 @@
"additionalProperties": false,
"properties": {
"key": {
"description": "URI pointing to a PEM encoded private key",
"description": "path to a PEM encoded private key",
"type": "string",
"format": "uri",
"examples": [
"/path/to/key.pem"
]
},
"cert": {
"description": "URI pointing to a PEM encoded certificate",
"description": "path to a PEM encoded certificate",
"type": "string",
"format": "uri",
"examples": [
"/path/to/cert.pem"
]
Expand Down Expand Up @@ -108,9 +106,15 @@
"default": false
},
"max_age": {
"description": "Indicates how long (in seconds) the results of a preflight request can be cached. The default is 0 which stands for no max age.",
"type": "integer",
"default": 0
"description": "Indicates how long the results of a preflight request can be cached. The default is 0s which stands for no max age.",
"type": "string",
"default": "0s",
"pattern": "^[0-9]+(ns|us|ms|s|m|h)$",
"examples": [
"5s",
"5m",
"5h"
]
}
}
},
Expand Down

0 comments on commit 58b6bc3

Please sign in to comment.