Skip to content

Commit

Permalink
undo
Browse files Browse the repository at this point in the history
  • Loading branch information
ramiAbdou committed Apr 3, 2024
1 parent 07dc19d commit 227dad6
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 14 deletions.

This file was deleted.

2 changes: 0 additions & 2 deletions packages/core/src/infrastructure/database/scripts/migrate.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import './before-script';

import { program } from 'commander';

import { migrate } from '../shared/migrate';
Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/infrastructure/database/scripts/seed.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import './before-script';

import { sql } from 'kysely';
import readline from 'readline';
import { z } from 'zod';
Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/infrastructure/database/scripts/setup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import './before-script';

import { exec } from 'child_process';
import path from 'path';
import { fileURLToPath } from 'url';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { CamelCasePlugin, Kysely, PostgresDialect } from 'kysely';
import { DB } from 'kysely-codegen/dist/db';
import pg from 'pg';

export function createDatabaseConnection() {
const DATABASE_URL = process.env.DATABASE_URL;
import { DATABASE_URL } from '@/shared/env';

export function createDatabaseConnection() {
if (!DATABASE_URL) {
throw new Error(
'"DATABASE_URL" must be set to establish a connection to the database.'
Expand Down
12 changes: 9 additions & 3 deletions packages/core/src/shared/env.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { config } from 'dotenv';

import { Environment } from './types';

export const ENVIRONMENT = process.env.ENVIRONMENT as Environment;
export const IS_PRODUCTION = ENVIRONMENT === 'production';
export const IS_TEST = ENVIRONMENT === 'test';
// Loads the .env file into `process.env`.
config();

export const ENV = {
AIRMEET_ACCESS_KEY: process.env.AIRMEET_ACCESS_KEY as string,
Expand Down Expand Up @@ -33,3 +34,8 @@ export const ENV = {
SWAG_UP_CLIENT_ID: process.env.SWAG_UP_CLIENT_ID as string,
SWAG_UP_CLIENT_SECRET: process.env.SWAG_UP_CLIENT_SECRET as string,
};

export const DATABASE_URL = process.env.DATABASE_URL as string;
export const ENVIRONMENT = process.env.ENVIRONMENT as Environment;
export const IS_PRODUCTION = ENVIRONMENT === 'production';
export const IS_TEST = ENVIRONMENT === 'test';

0 comments on commit 227dad6

Please sign in to comment.