diff --git a/api.env.example b/api.env.example new file mode 100644 index 00000000..5a003966 --- /dev/null +++ b/api.env.example @@ -0,0 +1,9 @@ +PORT= +CLIENT_ID= +CLIENT_SECRET= +OAUTH_CALLBACK_URL= +DASHBOARD_URL= +DB_HOST= +DB_USER= +DB_PASSWORD= +DB_DATABASE= diff --git a/bot.env.example b/bot.env.example new file mode 100644 index 00000000..8a2956a3 --- /dev/null +++ b/bot.env.example @@ -0,0 +1,5 @@ +TOKEN= +DB_HOST= +DB_USER= +DB_PASSWORD= +DB_DATABASE= diff --git a/dashboard/.env.example b/dashboard/.env.example new file mode 100644 index 00000000..fb6be76e --- /dev/null +++ b/dashboard/.env.example @@ -0,0 +1 @@ +API_URL= diff --git a/src/api/index.ts b/src/api/index.ts index c2de62b3..29da96ed 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,6 +1,6 @@ import { error, notFound } from "./responses"; -require("dotenv").config(); +require("dotenv").config({ path: path.resolve(__dirname, "..", "..", "api.env") }); import express from "express"; import cors from "cors"; @@ -8,6 +8,7 @@ import { initAuth } from "./auth"; import { initGuildsAPI } from "./guilds"; import { initArchives } from "./archives"; import { connect } from "../data/db"; +import path from "path"; console.log("Connecting to database..."); connect().then(() => { diff --git a/src/index.ts b/src/index.ts index d2e88fbe..ae56d20f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,7 +12,7 @@ import DiscordHTTPError from "eris/lib/errors/DiscordHTTPError"; // tslint:disab import { Configs } from "./data/Configs"; -require("dotenv").config(); +require("dotenv").config({ path: path.resolve(__dirname, "..", "bot.env") }); // Error handling let recentPluginErrors = 0;