Skip to content

Commit

Permalink
add safebox schema
Browse files Browse the repository at this point in the history
  • Loading branch information
adikari committed Jul 5, 2023
1 parent d8eb7ea commit aeee3ef
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 15 deletions.
6 changes: 6 additions & 0 deletions src/api/json/catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -4890,6 +4890,12 @@
],
"url": "https://json.schemastore.org/jfrog-pipelines.json"
},
{
"name": "Safebox Config Schema",
"description": "Schema for https://github.com/monebag/safebox",
"fileMatch": ["*safebox*.yaml"],
"url": "https://json.schemastore.org/safebox-schema-v1.0.0.json"
},
{
"name": "StrmPrivacy batch job configuration file",
"description": "StrmPrivacy batch job\nhttps://docs.strmprivacy.io/docs/latest/concepts/data-processing/batch-jobs/",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Configuration for safebox to deploy parameters to various parameter stores",
"type": "object",
"additionalProperties": false,
"description": "Configuration for safebox to deploy parameters to various parameter stores",
"properties": {
"service": {
"type": "string",
Expand All @@ -18,10 +17,27 @@
"description": "Prefix to apply to all parameters. Does not apply for shared",
"default": "/<stage>/<service>/"
},
"generate":{
"type": "array",
"description": "Generate different files based on the parameter name and values",
"items": {
"type": "object",
"properties": {
"type": {
"enum": ["json", "yaml", "dotenv", "types-node"],
"description": "Type of file to generate"
},
"path": {
"type": "string",
"description": "Full path with filename for writing the output"
}
}
}
},
"cloudformation-stacks": {
"type": "array",
"items": {
"type": "string"
"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"
},
Expand All @@ -32,11 +48,11 @@
"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>"
}
},
"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": {
Expand All @@ -46,16 +62,14 @@
"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>"
}
},
"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"
]
"required": ["service", "provider"],
"type": "object"
}
42 changes: 42 additions & 0 deletions src/test/safebox-schema-v1.0.0/safebox-full-valid.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
service: safebox
provider: ssm
prefix: '/test/'

generate:
- type: types-node
path: env.d.ts
- type: dotenv
path: .env

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

config:
defaults:
DB_NAME: 'database name updated'
CF_OUTPUT_API_ENDPOINT: '{{.internalDomainName}}'
NEW: 'endpoint-{{.stage}}'
NEW2: 'endpoint updated'
NEW3: 'endpoint updated'
AWS_REGION: '{{.region}}'
AWS_ACCOUNT: '{{.account}}'
CF_OUTPUT_BUCKET_ARN: '{{.BucketArn}}'
CF_OUTPUT_ENDPOINT: '{{.Endpoint}}'

prod:
DB_NAME: 'production db name'

dev:
DB_NAME: 'dev db name'

shared:
SHARED_KEY: 'shared key'

secret:
defaults:
API_KEY: 'key of the api endpoint'
DB_SECRET: 'database secret'

shared:
APOLLO_KEY: 'apollo key'
19 changes: 19 additions & 0 deletions src/test/safebox-schema-v1.0.0/safebox-short-valid.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
service: safebox
provider: ssm

config:
defaults:
DB_NAME: 'database name updated'
CF_OUTPUT_API_ENDPOINT: '{{.internalDomainName}}'
NEW: 'endpoint-{{.stage}}'

shared:
SHARED_KEY: 'shared key'

secret:
defaults:
API_KEY: 'key of the api endpoint'
DB_SECRET: 'database secret'

shared:
APOLLO_KEY: 'apollo key'

0 comments on commit aeee3ef

Please sign in to comment.