Skip to content

Commit

Permalink
change database url env var to postgres url
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasfrancisco committed Aug 19, 2024
1 parent 953d616 commit 118f946
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/migrate-db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
working-directory: apps/dashboard
run: pnpm db:migrate
env: # Or as an environment variable
DATABASE_URL: ${{ secrets.POSTGRES_URL }}
POSTGRES_URL: ${{ secrets.POSTGRES_URL }}
2 changes: 1 addition & 1 deletion apps/dashboard/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const env = createEnv({
GITHUB_APP_CLIENT_SECRET: z.string().min(1),
FIGMA_APP_CLIENT_ID: z.string().min(1),
FIGMA_APP_CLIENT_SECRET: z.string().min(1),
DATABASE_URL: z.string().min(1),
POSTGRES_URL: z.string().min(1),
ENVIRONMENT: z
.enum(['development', 'test', 'production'])
.default('production'),
Expand Down
6 changes: 3 additions & 3 deletions packages/database/drizzle.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ loadEnvConfig(process.cwd());

export const env = createEnv({
server: {
DATABASE_URL: z.string().url(),
POSTGRES_URL: z.string().url(),
ENVIRONMENT: z.enum(['development', 'test', 'production']),
},
runtimeEnv: {
DATABASE_URL: process.env.DATABASE_URL,
POSTGRES_URL: process.env.POSTGRES_URL,
ENVIRONMENT: process.env.ENVIRONMENT,
},
emptyStringAsUndefined: true,
Expand All @@ -24,7 +24,7 @@ export default defineConfig({
dialect: 'postgresql',
dbCredentials: {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- TODO: review
url: env.DATABASE_URL,
url: env.POSTGRES_URL,
},
verbose: env.ENVIRONMENT === 'development',
strict: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/database/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';
import * as schema from './schema';
import { env } from './config';
export const connection = postgres(env.DATABASE_URL, {
export const connection = postgres(env.POSTGRES_URL, {
max: 1,
});
export const database = drizzle(connection, {
Expand Down
2 changes: 1 addition & 1 deletion packages/database/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ loadEnvConfig(process.cwd());

export const env = createEnv({
server: {
DATABASE_URL: z.string().url(),
POSTGRES_URL: z.string().url(),
ENVIRONMENT: z.enum(['development', 'test', 'production']),
},
runtimeEnv: process.env,
Expand Down

0 comments on commit 118f946

Please sign in to comment.