Skip to content

Commit

Permalink
fix: preload dotenv instead import
Browse files Browse the repository at this point in the history
  • Loading branch information
devianllert committed Sep 1, 2019
1 parent 74b01a8 commit 16bdd23
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 14 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"main": "src/app.ts",
"scripts": {
"prod": "npm run build && npm run start",
"start": "cross-env NODE_ENV=production node dist/app.js",
"start": "cross-env NODE_ENV=production node --require dotenv/config dist/app.js",
"build": "npm run clean && tsc && npm run lint:fix",
"dev": "ts-node-dev --respawn --no-notify src/app.ts",
"dev": "ts-node-dev --respawn --no-notify --require dotenv/config src/app.ts",
"clean": "rimraf dist",
"lint": "eslint --ext .ts .",
"lint:fix": "eslint --fix --ext .ts .",
Expand Down
4 changes: 0 additions & 4 deletions src/core/BotConfig.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import dotenv from 'dotenv';

dotenv.config();

export interface BotConfig {
auto: {
deafen: boolean;
Expand Down
3 changes: 2 additions & 1 deletion src/core/BotConsoleReader.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import readline from 'readline';
import minimist from 'minimist';

import BotCommandMap from './BotCommandMap';
import logger from '../utils/logger';

import logger from '../utils/logger';

class BotConsoleReader {
public commands: BotCommandMap;
Expand Down
6 changes: 5 additions & 1 deletion src/core/BotMediaPlayer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import {
VoiceConnection, StreamDispatcher, TextChannel, DMChannel, GroupDMChannel,
VoiceConnection,
StreamDispatcher,
TextChannel,
DMChannel,
GroupDMChannel,
} from 'discord.js';

import BotStatus from './BotStatus';
Expand Down
3 changes: 0 additions & 3 deletions src/services/track.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import crypto from 'crypto';
import axios from 'axios';
import dotenv from 'dotenv';

import {
isYandexURL,
Expand All @@ -11,8 +10,6 @@ import {

import logger from '../utils/logger';

dotenv.config();

const downloadInfo = async (storageDir: string): Promise<DownloadInfo> => {
try {
const storageURL = `https://storage.mds.yandex.net/download-info/${storageDir}/2?format=json`;
Expand Down
3 changes: 0 additions & 3 deletions src/utils/logger.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import winston from 'winston';
import dotenv from 'dotenv';

dotenv.config();

const logger = winston.createLogger({
level: 'info',
Expand Down

0 comments on commit 16bdd23

Please sign in to comment.