Adding Dockerfile and build script

This commit is contained in:
Fabian
2019-10-01 17:45:38 +02:00
parent 65588f4b98
commit 405e589328
11 changed files with 98 additions and 45 deletions

View File

@ -13,7 +13,7 @@ const AdminRoute = new Router();
AdminRoute.use(async (ctx, next) => {
const { key } = ctx.query;
if (key !== config.general.admin)
if (key !== config.admin)
throw new NoPermissionError("No permission!");
return next();
})
@ -87,7 +87,7 @@ AdminRoute
}
})
.post("/database", async ctx => {
const { name, rules, publickey, accesskey } = ctx.request.body;
const { name, rules, publickey, accesskey, rootkey } = ctx.request.body;
if (!name)
throw new BadRequestError("Name must be set!");
@ -101,16 +101,22 @@ AdminRoute
if (rules)
await db.setRules(rules);
db
if (accesskey)
await db.setAccessKey(accesskey);
if (rootkey)
await db.setRootKey(rootkey);
ctx.body = "Success";
})
AdminRoute.get("/database/new", getForm("/v1/admin/database", "New/Change Database", {
name: { label: "Name", type: "text", },
accesskey: { label: "Access Key", type: "text" },
rootkey: { label: "Root access key", type: "text" },
rules: { label: "Rules", type: "textarea", value: `{\n ".write": true, \n ".read": true \n}` },
publickey: { label: "Public Key", type: "textarea" }
}))