mirror of
https://github.com/20kaushik02/spotify-manager.git
synced 2026-01-25 06:04:05 +00:00
dockerize!
changes to sequelize, env loading, ts workflow, minor improvements
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
// https://github.com/motdotla/dotenv/issues/133#issuecomment-255298822
|
||||
// explanation: in ESM, import statements execute first, unlike CJS where it's line order
|
||||
// so if placed directly in index.ts, the .config gets called after all other imports in index.ts
|
||||
// and one of those imports is the sequelize loader, which depends on env being loaded
|
||||
// soln: raise the priority of dotenv to match by placing it in a separate module like this
|
||||
|
||||
import { config, type DotenvConfigOutput } from "dotenv";
|
||||
|
||||
const result: DotenvConfigOutput = config({
|
||||
path: [
|
||||
`.env.${process.env["NODE_ENV"]}.local`,
|
||||
`.env.${process.env["NODE_ENV"]}`,
|
||||
".env.local",
|
||||
".env",
|
||||
],
|
||||
});
|
||||
|
||||
export default result;
|
||||
@@ -2,13 +2,21 @@ import type { SequelizeOptions } from "sequelize-typescript";
|
||||
|
||||
import logger from "../utils/logger.ts";
|
||||
|
||||
type ConnConfigs = Record<string, SequelizeOptions>;
|
||||
interface SeqOptsWithURI extends SequelizeOptions {
|
||||
use_env_variable: string;
|
||||
}
|
||||
type ConnConfigs = Record<string, SeqOptsWithURI>;
|
||||
|
||||
// env-specific config
|
||||
const connConfigs: ConnConfigs = {
|
||||
development: {},
|
||||
test: {},
|
||||
development: {
|
||||
use_env_variable: "DB_URI",
|
||||
},
|
||||
test: {
|
||||
use_env_variable: "DB_URI",
|
||||
},
|
||||
production: {
|
||||
use_env_variable: "DB_URI",
|
||||
// dialectOptions: {
|
||||
// ssl: true,
|
||||
// },
|
||||
|
||||
Reference in New Issue
Block a user