Skip to content

Commit

Permalink
server: add support for admin configuration via env
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Feb 25, 2023
1 parent f17ce50 commit bafe73d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions server/src/scrypted-server-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit bafe73d

Please sign in to comment.