mirror of
https://github.com/koush/scrypted.git
synced 2026-05-26 06:30:29 +01:00
server: add support for admin configuration via env
This commit is contained in:
@@ -194,6 +194,12 @@ async function start() {
|
||||
// lack of login from cookie auth.
|
||||
|
||||
const checkToken = (token: string) => {
|
||||
if (process.env.SCRYPTED_ADMIN_USERNAME && process.env.SCRYPTED_ADMIN_TOKEN === token) {
|
||||
res.locals.username = process.env.SCRYPTED_ADMIN_USERNAME;
|
||||
res.locals.aclId = process.env.SCRYPTED_ADMIN_TOKEN;
|
||||
return;
|
||||
}
|
||||
|
||||
const [checkHash, ...tokenParts] = token.split('#');
|
||||
const tokenPart = tokenParts?.join('#');
|
||||
if (checkHash && tokenPart) {
|
||||
|
||||
Reference in New Issue
Block a user