Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: 로컬에서 db 실행 #668

Merged
merged 4 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,13 @@ dist
.DS_Store

################################################################################
00_init.sql
database/*.sql
database/data/
_*

.vscode
package-lock.json
.idea

# nginx
.htpasswd
8 changes: 5 additions & 3 deletions backend/src/config/dbSchema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { envObject } from './envObject';
import { envObject, nonempty } from './envObject';

/** RDS 연결 옵션 파싱을 위한 스키마 */
export const rdsSchema = envObject('RDS_HOSTNAME', 'RDS_USERNAME', 'RDS_PASSWORD', 'RDS_DB_NAME')
Expand All @@ -11,14 +11,16 @@ export const rdsSchema = envObject('RDS_HOSTNAME', 'RDS_USERNAME', 'RDS_PASSWORD

/** MYSQL 연결 옵션 파싱을 위한 스키마 */
const mysqlSchema = envObject('MYSQL_USER', 'MYSQL_PASSWORD', 'MYSQL_DATABASE')
.extend({ MYSQL_HOST: nonempty.default('database') })
.transform((v) => ({
host: v.MYSQL_HOST,
username: v.MYSQL_USER,
password: v.MYSQL_PASSWORD,
database: v.MYSQL_DATABASE,
}));

/** MYSQL 로컬 환경 연결 옵션 파싱을 위한 스키마 */
export const localSchema = mysqlSchema.transform((args) => ({ ...args, host: 'localhost' as const }));
export const localSchema = mysqlSchema;

/** MYSQL 배포 환경 연결 옵션 파싱을 위한 스키마 */
export const prodSchema = mysqlSchema.transform((args) => ({ ...args, host: 'database' as const }));
export const prodSchema = mysqlSchema;
205 changes: 0 additions & 205 deletions database/00_create_table.sql

This file was deleted.

Loading