-
Notifications
You must be signed in to change notification settings - Fork 12
/
config.yaml
113 lines (101 loc) · 2.99 KB
/
config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# FOCA CONFIGURATION
# Available in app context as attributes of `current_app.config.foca`
# Automatically validated via FOCA
# Cf. https://foca.readthedocs.io/en/latest/modules/foca.models.html
# SERVER CONFIGURATION
# Cf. https://foca.readthedocs.io/en/latest/modules/foca.models.html#foca.models.config.ServerConfig
server:
host: '0.0.0.0'
port: 8080
debug: True
environment: development
testing: False
use_reloader: False
# EXCEPTION CONFIGURATION
# Cf. https://foca.readthedocs.io/en/latest/modules/foca.models.html#foca.models.config.ExceptionConfig
exceptions:
required_members: [['msg'], ['status']]
status_member: ['status']
exceptions: my_app.exceptions.exceptions
# SECURITY CONFIGURATION
# Cf. https://foca.readthedocs.io/en/latest/modules/foca.models.html#foca.models.config.SecurityConfig
security:
auth:
add_key_to_claims: True
algorithms:
- RS256
allow_expired: False
audience: null
validation_methods:
- userinfo
- public_key
validation_checks: any
# API CONFIGURATION
# Cf. https://foca.readthedocs.io/en/latest/modules/foca.models.html#foca.models.config.APIConfig
api:
specs:
- path:
- path/to/my/openapi/specs.yaml
add_operation_fields:
x-openapi-router-controller: myapi.controllers
add_security_fields:
x-bearerInfoFunc: app.validate_token
disable_auth: False
connexion:
strict_validation: True
validate_responses: True
options:
swagger_ui: True
serve_spec: True
# DATABASE CONFIGURATION
# Cf. https://foca.readthedocs.io/en/latest/modules/foca.models.html#foca.models.config.DBConfig
db:
host: mongodb
port: 27017
dbs:
myDb:
collections:
myCollection:
indexes:
- keys:
id: 1
options:
'unique': True
# WORKER CONFIGURATION
# Cf. https://foca.readthedocs.io/en/latest/modules/foca.models.html#foca.models.config.JobsConfig
jobs:
host: rabbitmq
port: 5672
backend: 'rpc://'
include:
- my_app.tasks.my_task_1
- my_app.tasks.my_task_2
# LOGGING CONFIGURATION
# Cf. https://foca.readthedocs.io/en/latest/modules/foca.models.html#foca.models.config.LogConfig
log:
version: 1
disable_existing_loggers: False
formatters:
standard:
class: logging.Formatter
style: "{"
format: "[{asctime}: {levelname:<8}] {message} [{name}]"
handlers:
console:
class: logging.StreamHandler
level: 20
formatter: standard
stream: ext://sys.stderr
root:
level: 10
handlers: [console]
# CUSTOM APP CONFIGURATION
# Available in app context as attributes of `current_app.config.foca`
# Can be validated by FOCA by passing a Pydantic model class to the
# `custom_config_model` parameter in the `foca.Foca()` constructor
custom:
my_param: 'some_value'
# Any other sections/parameters are *not* validated by FOCA; if desired,
# validate parameters in app
custom_params_not_validated:
my_other_param: 'some_other_value'