Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/modules/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ export class AuthService implements OnModuleInit {
let isNewKey = false;

if (count === 0) {
// Use predictable key in development, random key in production
displayKey =
process.env.NODE_ENV === 'production' ? `owa_k1_${randomBytes(32).toString('hex')}` : 'dev-admin-key';
// Use env var if set, otherwise auto-generate predictable key in development, random key in production
displayKey = process.env.API_MASTER_KEY
|| (process.env.NODE_ENV === 'production'
? `owa_k1_${randomBytes(32).toString('hex')}`
: 'dev-admin-key');

await this.seedApiKey(displayKey, 'Default Admin Key', ApiKeyRole.ADMIN);
isNewKey = true;
Expand Down