mirror of
https://github.com/mii443/did-web-on-gh-pages.git
synced 2025-08-22 23:15:46 +00:00
config validation
This commit is contained in:
14
package-lock.json
generated
14
package-lock.json
generated
@ -11,6 +11,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"did-jwt": "^6.0.0",
|
"did-jwt": "^6.0.0",
|
||||||
"jose": "^4.6.0",
|
"jose": "^4.6.0",
|
||||||
|
"readline-sync": "^1.4.10",
|
||||||
"web-did-resolver": "^2.0.14"
|
"web-did-resolver": "^2.0.14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -299,6 +300,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/readline-sync": {
|
||||||
|
"version": "1.4.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/readline-sync/-/readline-sync-1.4.10.tgz",
|
||||||
|
"integrity": "sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/tr46": {
|
"node_modules/tr46": {
|
||||||
"version": "0.0.3",
|
"version": "0.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
||||||
@ -608,6 +617,11 @@
|
|||||||
"whatwg-url": "^5.0.0"
|
"whatwg-url": "^5.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"readline-sync": {
|
||||||
|
"version": "1.4.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/readline-sync/-/readline-sync-1.4.10.tgz",
|
||||||
|
"integrity": "sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw=="
|
||||||
|
},
|
||||||
"tr46": {
|
"tr46": {
|
||||||
"version": "0.0.3",
|
"version": "0.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"did-jwt": "^6.0.0",
|
"did-jwt": "^6.0.0",
|
||||||
"jose": "^4.6.0",
|
"jose": "^4.6.0",
|
||||||
|
"readline-sync": "^1.4.10",
|
||||||
"web-did-resolver": "^2.0.14"
|
"web-did-resolver": "^2.0.14"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"DOMAIN": "chike.xyz",
|
"DOMAIN": "{GitHubUserName}.github.io",
|
||||||
"REPOSITORY": "did-web-on-gh-pages"
|
"REPOSITORY": "did-web-on-gh-pages"
|
||||||
}
|
}
|
@ -1,9 +1,23 @@
|
|||||||
const jose = require('jose');
|
const jose = require('jose');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const readlineSync = require('readline-sync');
|
||||||
|
|
||||||
// Setting
|
// Setting
|
||||||
const CONFIG = require('./config.json');
|
const CONFIG = require('./config.json');
|
||||||
|
const { exit } = require('process');
|
||||||
|
|
||||||
|
// Validate Config
|
||||||
|
if (CONFIG.DOMAIN == '{GitHubUserName}.github.io') {
|
||||||
|
console.log(`ERROR: Domain in config.json is default ({GitHubUserName}.github.io). Please set your domain.`)
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CONFIG.REPOSITORY == 'did-web-on-gh-pages') {
|
||||||
|
console.log(`WARN: Domain in config.json is default (did-web-on-gh-pages).`);
|
||||||
|
if (!readlineSync.keyInYN(`Is the repository name correct?`)) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Templates
|
// Templates
|
||||||
const DID = `did:web:${CONFIG.DOMAIN}:${CONFIG.REPOSITORY}`;
|
const DID = `did:web:${CONFIG.DOMAIN}:${CONFIG.REPOSITORY}`;
|
||||||
|
Reference in New Issue
Block a user