File tree Expand file tree Collapse file tree 4 files changed +8
-14
lines changed
Expand file tree Collapse file tree 4 files changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ const app = new Hono();
1717
1818// Check for required credentials in environment
1919try {
20- ensureEnv ( [ "JWT_SECRET" ] ) ;
20+ ensureEnv ( [ "JWT_SECRET" , "ADMIN_USER" , "ADMIN_PASS" ] ) ;
2121
2222 const { username : adminUsername , password : adminPassword } = getAdminCredentials ( ) ;
2323 if ( ! adminUsername || adminUsername . trim ( ) . length === 0 ) {
Original file line number Diff line number Diff line change 11import type { Context , Next } from "hono" ;
22import { verifyJWT } from "../utils/jwt.ts" ;
3-
4- function getAdminCredentials ( ) : { username : string ; password : string } {
5- return {
6- username : Deno . env . get ( "ADMIN_USER" ) || "admin" ,
7- password : Deno . env . get ( "ADMIN_PASS" ) || "supersecret" ,
8- } ;
9- }
3+ import { getAdminCredentials } from "../utils/env.ts" ;
104
115function unauthorized ( ) : Response {
126 return new Response ( "Unauthorized" , {
Original file line number Diff line number Diff line change @@ -6,9 +6,9 @@ services:
66 env_file :
77 - .env
88 environment :
9- ADMIN_USER : ${ADMIN_USER:-admin }
10- ADMIN_PASS : ${ADMIN_PASS:-supersecret }
11- JWT_SECRET : ${JWT_SECRET:-change-me-in-prod }
9+ ADMIN_USER : ${ADMIN_USER}
10+ ADMIN_PASS : ${ADMIN_PASS}
11+ JWT_SECRET : ${JWT_SECRET}
1212 DATABASE_PATH : ${DATABASE_PATH:-/app/data/invio.db}
1313 volumes :
1414 - invio_data:/app/data
Original file line number Diff line number Diff line change @@ -6,9 +6,9 @@ services:
66 env_file :
77 - .env
88 environment :
9- ADMIN_USER : ${ADMIN_USER:-admin }
10- ADMIN_PASS : ${ADMIN_PASS:-supersecret }
11- JWT_SECRET : ${JWT_SECRET:-change-me-in-prod }
9+ ADMIN_USER : ${ADMIN_USER}
10+ ADMIN_PASS : ${ADMIN_PASS}
11+ JWT_SECRET : ${JWT_SECRET}
1212 DATABASE_PATH : ${DATABASE_PATH:-/app/data/invio.db}
1313 volumes :
1414 - invio_data:/app/data
You can’t perform that action at this time.
0 commit comments