Skip to content

Commit

Permalink
add json schema
Browse files Browse the repository at this point in the history
  • Loading branch information
adikari committed Jul 5, 2023
1 parent aebd4c2 commit 203f740
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ To install it directly find the right version for your machine in [releases](htt
1. Create a configuration file called `safebox.yml`.

```yaml
# yaml-language-server: $schema=https://raw.githubusercontent.com/monebag/safebox/main/schema.json
service: my-service
provider: ssm

Expand Down
1 change: 1 addition & 0 deletions example/custom-prefix.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# yaml-language-server: $schema=../schema.json
service: safebox
provider: ssm

Expand Down
5 changes: 3 additions & 2 deletions example/safebox.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# yaml-language-server: $schema=../schema.json
service: safebox
provider: ssm

cloudformation-stacks:
- "{{.stage}}-shared-infra-SharedInfraServerless"
- "{{.stage}}-user-debug-stack"

config:
defaults:
DB_NAME: "database name updated"
Expand Down
1 change: 1 addition & 0 deletions example/secretsmanager.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# yaml-language-server: $schema=../schema.json
service: safebox
provider: secrets-manager

Expand Down
58 changes: 58 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"additionalProperties": false,
"description": "Configuration for safebox to deploy parameters to various parameter stores",
"properties": {
"service": {
"type": "string",
"description": "Name of the service. parameters will be prefixed by the value provided"
},
"provider": {
"type": "string",
"enum": ["ssm", "secrets-manager"],
"description": "Deploy parameters to the given provider. Eg. ssm, secrets-manager"
},
"prefix": {
"type": "string",
"description": "Prefix to apply to all parameters. Does not apply for shared",
"default": "/<stage>/<service>/"
},
"cloudformation-stacks": {
"type": "array",
"items": {
"type": "string"
},
"description": "Cloudformation stack names. Any output values from the stacks can be interpolated. Eg. DB_NAME: \"{{.myDbName}}\"\nmyDbName is the output of one of the cloudformation stacks"
},
"config": {
"type": "object",
"description": "Parameters to deploy as non secret. You can also specify stage specific key value pairs. Same key in the defaults will be ignored and stage specific value will be used.",
"properties": {
"defaults": {
"type": "object",
"description": "parameter name and value. Output is /<stage>/<service>/<param name>"
},
"shared": {
"type": "object",
"description": "Params that are to be shared between multiple services. The parameter name wont be prefixed by service name. Output is /<stage>/shared/<param name>"
}
}
},
"secret": {
"type": "object",
"description": "Parameters to deploy as secret. You cannot specify stage specific key value pairs. Value is the description. You will need to run safebox deploy in prompt mode to provide the actual value.",
"properties": {
"defaults": {
"type": "object",
"description": "parameter name and value. Output is /<stage>/<service>/<param name>"
},
"shared": {
"type": "object",
"description": "Params that are to be shared between multiple services. The parameter name wont be prefixed by service name. Output is /<stage>/shared/<param name>"
}
}
}
},
"required": ["service", "provider"],
"type": "object"
}

0 comments on commit 203f740

Please sign in to comment.