βοΈ Default Config
Welcome! This step-by-step guide will show you how to create a default config for your schema to make deploying your service an absolute breeze. π
π§ Assumptionsβ
This guide assumes you already understand how to create schemas and have one ready for your service. Haven't created a schema yet? No problem! Stop here and check out the Zero to Hero guide first.
Note: The examples below use the my-schema (version v1) created in the Zero to Hero guide.
π οΈ Create Your Default Configβ
1. Create the File
Create a new file named v1.configs.json in the exact same folder as your schema file.
[]
2. Name Your Config
Choose a clear, descriptive name for your default configuration.
[
{
"name": "default-config",
"value": {}
}
]
3. Populate the Values
Add the default values that align perfectly with your schema properties!
[
{
"name": "default-config",
"value": {
"id": "default-id",
"name": "default-name",
"age": 18,
"isAlive": true
}
}
]
β Run Validationsβ
Always validate your work to ensure the default config is perfectly formatted! Run the validation script:
npm run validate
π Add a Reference to Another Configβ
Need to dry up your code? If your default config relies on a reference to another config or a shared common config, you can easily reference it directly in the value object:
[
{
"name": "default-config",
"value": {
"commonConfig": {
"$ref": {
"configName": "other-config",
"version": "latest"
}
}
}
}
]
π Next Stepsβ
Boom! You are done writing your default config. π
- Submit a PR to the schemas repo and request a review from the team.
- Need Help? Don't hesitate to reach out if you get stuck.
- Have Ideas? If you have suggestions to improve this guide, please open a pull request!