Skip to main content

Default config

Step by step guide on how to create a default config for your schema to ease the deployment of your service.

Assumptions

This guide assumes that you have an understanding of creating schemas and already created a schema for your service. Check out the Zero to Hero guide if you haven't created a schema yet.

The examples in this guide will use the schema my-schema with version v1 that was created in the Zero to Hero guide.

create your default config

  1. Create a file named v1.configs.json in the same folder as your schema file.
schemas/my-domain/my-schema/v1.configs.json
[]
  1. Choose a name for your default config:
schemas/my-domain/my-schema/v1.configs.json
[
{
"name": "default-config",
"value": {}
}
]
  1. Add the default config value based on the schema:
schemas/my-domain/my-schema/v1.configs.json
[
{
"name": "default-config",
"value": {
"id": "default-id",
"name": "default-name",
"age": 18
"isAlive": true
}
}
]

Run validations

Run the validation script to make sure the default config is valid.

npm run validate

Add a reference to another default config

If your default config has a reference to another config you created, or a common config you can reference it in the value:

schemas/my-domain/my-schema/v1.configs.json
[
{
"name": "default-config",
"value": {
"commonConfig": {
"$ref": {
"configName": "other-config",
"version": "latest"
}
}
}
}
]

Next steps

Now that you finished writing your default config, you can submit a PR to the schemas repo and ask for it to be reviewed.

If you have any questions or need help, feel free to ask for help.

If you have any suggestions for this guide, please open a pull request.