Skip to content

Commit

Permalink
🐛 readSecret
Browse files Browse the repository at this point in the history
  • Loading branch information
Mario-SO committed Dec 26, 2024
1 parent 25c4c9b commit 666461c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 28 deletions.
27 changes: 0 additions & 27 deletions packages/server/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { RegisterRoutes } from './routes/routes';
import * as swaggerDocument from './swagger/swagger.json';
import { logger } from './utils/logger';
import ErrorMiddleware from './middlewares/error.middleware';
import * as fs from 'fs';

class App {
public app: express.Application;
Expand Down Expand Up @@ -44,7 +43,6 @@ class App {
logger.info(`======= ENV: ${this.env} ========`);
logger.info(`🚀 App listening on the port ${this.port}`);
logger.info(`=================================`);
this.logRemotionWebhookSecret();
});
}

Expand All @@ -60,32 +58,7 @@ class App {
getServer() {
return this.app;
}
private readSecretFile = (path) => {
// Add debug logging
console.log('Attempting to read secret file, path:', path);

if (!path) {
console.warn('No path provided for secret file');
return undefined;
}

if (process.env.NODE_ENV === 'development') {
return path;
}

try {
return fs.readFileSync(path, 'utf8').trim();
} catch (error) {
console.error(`Error reading secret file ${path}:`, error);
return undefined;
}
};

private logRemotionWebhookSecret() {
logger.info(`Remotion webhook secret: ${this.readSecretFile(process.env.SERVER_WEBHOOK_SECRET_FILE)}`);
}


private async connectToDatabase() {
if (this.env !== 'production') {
set('debug', true);
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const config = {
remotion: {
id: validatedEnv.REMOTION_ID,
host: validatedEnv.REMOTION_BASE_URL,
webhookSecretKey: validatedEnv.REMOTION_WEBHOOK_SECRET_FILE,
webhookSecretKey: readSecretFile(validatedEnv.REMOTION_WEBHOOK_SECRET_FILE),
},
redis: {
host: validatedEnv.REDIS_HOST,
Expand Down

0 comments on commit 666461c

Please sign in to comment.