-
Notifications
You must be signed in to change notification settings - Fork 0
configuration
It is possible to configure Mimus Serve via a configuration. Sometimes it could be easier than using the command line. Some parameters are only available using the configuration file.
The configuration file must be in the YAML format and follow this structure:
general:
host: localhost
port: 4000
files: "./files"
mappings: "./mappings"
datasets: "./datasets"
transform: true
logging:
logger: info
cors:
origin:
- http://www.test-cors.org
- http://localhost:3001
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS']
allowedHeaders: 'Content-Type, Authorization, Accept'
port
: set the port number to listen to. For instance, 3000. Defaults to 4000
.
host
: The host or IP adress to bind to. Defaults to localhost
.
logger
: The logger level to use. If this parameter is not specified no logging is done. Logger values can be error
, warn
, info
, debug
.
files
: set the path from which to find files referenced with bodyFileName. Default to ./files
.
mappings
: set the path from which to find mapping files. All files with extension *.json
or *.yaml
are read to build the mapping configuration. Default to ./mapping
.
datasets
: set the path from which to find dataset files. All files with extension *.json
, *.yml
or *.yaml
are read to create datasets. The name of the file will be the dataset name. Default to ./datasets
.
transform
: Force template expansion (handlebars) for all mappings.
cors
: The cors configuration (optional)
cors.origin
: can be either false
, true
, *
, a string or a list of hosts - false
no cors configuration is put in place. - true
cors is active and to reflect the request origin. - *
cors configuration is active and allows any origin - A string to allow a specific origin - A list to allow an array of valid origins
cors.method
: Configures the Access-Control-Allow-Methods CORS header. Expects a comma-delimited string (ex: 'GET,PUT,POST') or an array (ex: ['GET', 'PUT', 'POST']).
cors.allowedHeaders
: Configures the Access-Control-Allow-Headers CORS header. Expects a comma-delimited string (ex: 'Content-Type,Authorization')
cors.exposedHeaders
: Configures the Access-Control-Expose-Headers CORS header. Expects a comma-delimited string (ex: 'Content-Range,X-Content-Range')
cors.credentials
: Configures the Access-Control-Allow-Credentials CORS header. Set to true to pass the header, otherwise it is omitted.
cors.maxAge
: Configures the Access-Control-Max-Age CORS header. In seconds. Set to an integer to pass the header, otherwise it is omitted.
The cors configuration is mapping almost exactly to fastify-cors configuration.