Skip to content

Commit

Permalink
Change loading of dotenv file to be simpler
Browse files Browse the repository at this point in the history
  • Loading branch information
ThisIsMissEm committed Nov 13, 2023
1 parent 4885b00 commit 3f1c1b8
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions streaming/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ const WebSocket = require('ws');

const environment = process.env.NODE_ENV || 'development';

// Correctly detect .env/.env.production files based on whether we're running
// from the streaming/ directory or the root of the mastodon project.
// Correctly detect and load .env or .env.production file based on environment:
const dotenvFile = environment === 'production' ? '.env.production' : '.env';
const dotenvDir = path.basename(process.cwd()) === 'streaming' ? `../` : './';

dotenv.config({
path: path.resolve(dotenvDir, dotenvFile)
path: path.resolve(__dirname, path.join('..', dotenvFile))
});

log.level = process.env.LOG_LEVEL || 'verbose';
Expand Down

0 comments on commit 3f1c1b8

Please sign in to comment.