Skip to content

Commit 8f08455

Browse files
committed
feat(client): validate config
1 parent 4893513 commit 8f08455

File tree

4 files changed

+213
-36
lines changed

4 files changed

+213
-36
lines changed

package-lock.json

Lines changed: 163 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
"license": "MIT",
1111
"repository": "github:gochomugo/local-webhooks",
1212
"scripts": {
13-
"format": "prettier --write '{src,www,.github}/**/*.{html,js,yml}' './*.{json,md,yml}'",
13+
"format": "prettier --write '{src,www,.github}/**/*.{html,js,yml}' '{schemas/**/,./}*.{json,md,yml}'",
1414
"image": "docker build --tag ${npm_package_config_docker_tag}:${npm_package_version} .",
1515
"push-image": "docker push ${npm_package_config_docker_tag}:${npm_package_version}",
1616
"start": "bin/lw-server",
1717
"test": "npm run test:format && npm run test:lint",
18-
"test:format": "prettier --check '{src,www,.github}/**/*.{html,js,yml}' './*.{json,md,yml}'",
18+
"test:format": "prettier --check '{src,www,.github}/**/*.{html,js,yml}' '{schemas/**/,./}*.{json,md,yml}'",
1919
"test:lint": "eslint src/"
2020
},
2121
"bin": {
@@ -24,6 +24,8 @@
2424
},
2525
"dependencies": {
2626
"@forfuture/wserver": "^0.3.2",
27+
"ajv": "^8.17.1",
28+
"ajv-formats": "^3.0.1",
2729
"chalk": "^5.6.2",
2830
"express": "^5.1.0",
2931
"pg": "^8.16.3",

schemas/config-schema.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"type": "object",
3+
"properties": {
4+
"remoteUrl": {
5+
"type": "string"
6+
},
7+
"localApps": {
8+
"type": "array",
9+
"items": {
10+
"type": "object",
11+
"properties": {
12+
"name": {
13+
"minLength": 1,
14+
"type": "string"
15+
},
16+
"secret": {
17+
"minLength": 1,
18+
"type": "string"
19+
},
20+
"url": {
21+
"format": "uri",
22+
"type": "string"
23+
}
24+
},
25+
"required": ["name", "secret", "url"],
26+
"additionalProperties": false
27+
}
28+
}
29+
},
30+
"additionalProperties": false
31+
}

0 commit comments

Comments
 (0)