Skip to content

Commit

Permalink
add json schema for batch config
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmood committed Jan 16, 2024
1 parent 602a5c3 commit f9d7486
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Create a json file `whisper.json` with the content:

```json
{
"$schema": "https://raw.githubusercontent.com/ysmood/whisper/main/batch_schema.json",
"files": {
"secrets/backend": ["@jack"],
"secrets/db.txt": ["@tom"]
Expand Down Expand Up @@ -129,6 +130,7 @@ the `$` prefix means a group name:

```jsonc
{
"$schema": "https://raw.githubusercontent.com/ysmood/whisper/main/batch_schema.json",
"groups": {
"$frontend": ["@mike", "@tim"],
"$backend": ["$frontend", "@jack"] // group reference can be recursive
Expand Down
41 changes: 41 additions & 0 deletions batch_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"$schema": "http://json-schema.org/draft-04/schema",
"description": "A whisper configure file for batch operations. Doc: https://github.com/ysmood/whisper",
"properties": {
"groups": {
"description": "Defines groups of members. The key is the group name, each name should start with '$'.",
"type": "object",
"patternProperties": {
"^\\$.+": {
"$ref": "#/definitions/group"
}
}
},
"admins": {
"description": "Defines the admin group. Members in this group can decrypt all the files.",
"$ref": "#/definitions/group"
},
"files": {
"description": "Defines the files to encrypt and who can decrypt them. The key is a file path or dir path. The path should relative to the config file, and uses '/' as the path separator.",
"patternProperties": {
"": {
"$ref": "#/definitions/group"
}
}
},
"outDir": {
"description": "Defines the output directory for encrypted files. The path should relative to the config file, and uses '/' as the path separator.",
"type": "string"
}
},
"definitions": {
"group": {
"description": "Defines a group of members.",
"type": "array",
"items": {
"description": "Defines a member. It can be a group name with prefix '$', github user id with prefix '@', ssh authorized_keys file path, or authorized_keys file url with prefix '@'.",
"type": "string"
}
}
}
}

0 comments on commit f9d7486

Please sign in to comment.