create-entity-server 0.0.25 → 0.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/package.json +1 -1
  2. package/template/.env.example +38 -0
  3. package/template/configs/auth/cors.json +15 -0
  4. package/template/configs/auth/identity.json +27 -0
  5. package/template/configs/auth/jwt.json +12 -0
  6. package/template/configs/{oauth.json → auth/oauth.json} +7 -4
  7. package/template/configs/auth/password.json +33 -0
  8. package/template/configs/auth/privacy_policy.json +28 -0
  9. package/template/configs/{security.json → auth/security.json} +4 -2
  10. package/template/configs/auth/two_factor.json +12 -0
  11. package/template/configs/database.json +0 -159
  12. package/template/configs/database.json.example +186 -0
  13. package/template/configs/extensions/backup.json +46 -0
  14. package/template/configs/extensions/pg.json +37 -0
  15. package/template/configs/extensions/storage.json +148 -0
  16. package/template/configs/extensions/tax-invoice.json +59 -0
  17. package/template/configs/keys/.gitkeep +0 -0
  18. package/template/configs/keys/apns.p8.example +7 -0
  19. package/template/configs/keys/firebase.pem.example +7 -0
  20. package/template/configs/notification/alimtalk.json +75 -0
  21. package/template/configs/{push.json → notification/push.json} +1 -2
  22. package/template/configs/notification/sms.json +54 -0
  23. package/template/configs/notification/smtp.json +43 -0
  24. package/template/configs/server.json +2 -0
  25. package/template/entities/README.md +20 -23
  26. package/template/entities/System/Auth/account.json +17 -1
  27. package/template/entities/System/Auth/account_audit.json +23 -0
  28. package/template/entities/System/Auth/account_device.json +63 -0
  29. package/template/entities/System/Auth/account_login_log.json +54 -0
  30. package/template/entities/System/Auth/account_oauth.json +45 -0
  31. package/template/entities/System/Auth/api_keys.json +1 -1
  32. package/template/entities/System/Auth/identity_verification.json +95 -0
  33. package/template/entities/System/Auth/license.json +1 -1
  34. package/template/entities/System/Auth/password_history.json +20 -0
  35. package/template/entities/System/Auth/rbac_roles.json +1 -1
  36. package/template/entities/System/Backup/backup_log.json +62 -0
  37. package/template/entities/System/Email/smtp_log.json +83 -0
  38. package/template/entities/System/Email/smtp_msg.json +104 -0
  39. package/template/entities/System/Notification/alimtalk_log.json +45 -0
  40. package/template/entities/System/Notification/alimtalk_msg.json +39 -0
  41. package/template/entities/System/Notification/friendtalk_log.json +48 -0
  42. package/template/entities/System/Notification/friendtalk_msg.json +63 -0
  43. package/template/entities/System/Notification/sms_log.json +26 -0
  44. package/template/entities/System/Notification/sms_msg.json +52 -0
  45. package/template/entities/System/Notification/sms_verification.json +40 -0
  46. package/template/entities/System/Payment/pg_cancel.json +45 -0
  47. package/template/entities/System/Payment/pg_order.json +88 -0
  48. package/template/entities/System/Payment/pg_webhook_log.json +37 -0
  49. package/template/entities/System/Push/push_log.json +71 -0
  50. package/template/entities/System/Push/push_msg.json +55 -0
  51. package/template/entities/System/Storage/file_backup_log.json +46 -0
  52. package/template/entities/System/Storage/file_download_log.json +41 -0
  53. package/template/entities/System/Storage/file_meta.json +59 -0
  54. package/template/entities/System/system_audit_log.json +2 -1
  55. package/template/entities/company.json +1 -1
  56. package/template/entities/{product.json → goods.json} +6 -10
  57. package/template/entities/todo.json +1 -1
  58. package/template/samples/entities/README.md +2 -2
  59. package/template/scripts/generate-env-keys.sh +16 -0
  60. package/template/templates/email/account/dormancy_warning.html +20 -0
  61. package/template/templates/email/account/password_expiry_warning.html +21 -0
  62. package/template/templates/email/auth/2fa_disabled.html +23 -0
  63. package/template/templates/email/auth/2fa_recovery_regenerated.html +31 -0
  64. package/template/templates/email/auth/2fa_setup_complete.html +43 -0
  65. package/template/templates/email/auth/email_verification.html +18 -0
  66. package/template/templates/email/auth/force_reset.html +18 -0
  67. package/template/templates/email/auth/password_reset.html +19 -0
  68. package/template/templates/email/auth/verification.html +15 -0
  69. package/template/templates/email/auth/verification_link.html +25 -0
  70. package/template/templates/email/auth/welcome.html +18 -0
  71. package/template/templates/email/backup/backup_completed.html +35 -0
  72. package/template/templates/email/backup/backup_failed.html +27 -0
  73. package/template/templates/email/backup/backup_partial.html +31 -0
  74. package/template/templates/email/layout.html +47 -0
  75. package/template/templates/email/order/order_confirmation.html +30 -0
  76. package/template/templates/email/storage/storage_quota_exceeded.html +37 -0
  77. package/template/templates/email/storage/storage_quota_warning.html +37 -0
  78. package/template/configs/cors.json +0 -7
  79. package/template/configs/jwt.json +0 -8
  80. package/template/entities/Account/account_audit.json +0 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-entity-server",
3
- "version": "0.0.25",
3
+ "version": "0.0.27",
4
4
  "description": "Create a new entity-server project in one command — like create-react-app or create-vite.",
5
5
  "keywords": [
6
6
  "entity-server",
@@ -11,6 +11,10 @@ ENCRYPTION_KEY=your-32-char-hex-encryption-key-here
11
11
  # 운영에서는 충분히 긴 랜덤 시크릿을 사용하세요.
12
12
  JWT_SECRET=your-jwt-secret-here
13
13
 
14
+ # 백업 암호화 키 (backup.json의 ${BACKUP_ENCRYPT_KEY}와 매핑)
15
+ # 비워두면 암호화 비활성화. 설정 시 충분한 길이의 랜덤 문자열 권장.
16
+ # BACKUP_ENCRYPT_KEY=your-backup-encryption-key-here
17
+
14
18
  # 서버 포트 (configs/server.json의 port를 오버라이드)
15
19
  SERVER_PORT=47200
16
20
 
@@ -27,5 +31,39 @@ DB_NAME_PRODUCTION=your-production-db-name
27
31
  DB_USER_PRODUCTION=your-production-db-user
28
32
  DB_PASSWORD_PRODUCTION=your-production-db-password
29
33
 
34
+ # SMTP 이메일 (smtp.json에서 ${SMTP_USERNAME} 등으로 참조)
35
+ # SMTP_USERNAME=user@gmail.com
36
+ # SMTP_PASSWORD=your-app-specific-password
37
+ # SENDGRID_API_KEY=SG.xxxx...
38
+ # SES_SMTP_USERNAME=your-ses-smtp-username
39
+ # SES_SMTP_PASSWORD=your-ses-smtp-password
40
+ # MAILGUN_SMTP_PASSWORD=your-mailgun-smtp-password
41
+
30
42
  # 푸시 알림 (push.json에서 ${FCM_PROJECT_ID} 등으로 참조 가능)
31
43
  # FCM_PROJECT_ID=your-firebase-project-id
44
+
45
+ # OAuth 소셜 로그인 (configs/auth/oauth.json)
46
+ # OAUTH_STATE_SECRET=your-random-oauth-state-secret
47
+ # OAUTH_SUCCESS_REDIRECT_URL=https://your-frontend.example.com/auth/success
48
+ # OAUTH_FAILURE_REDIRECT_URL=https://your-frontend.example.com/auth/fail
49
+ # GOOGLE_CLIENT_ID=your-google-client-id
50
+ # GOOGLE_CLIENT_SECRET=your-google-client-secret
51
+ # GITHUB_CLIENT_ID=your-github-client-id
52
+ # GITHUB_CLIENT_SECRET=your-github-client-secret
53
+ # NAVER_CLIENT_ID=your-naver-client-id
54
+ # NAVER_CLIENT_SECRET=your-naver-client-secret
55
+ # KAKAO_CLIENT_ID=your-kakao-client-id
56
+ # KAKAO_CLIENT_SECRET=your-kakao-client-secret
57
+
58
+ # SMS (configs/notification/sms.json)
59
+ # SMS_SENDER_NUMBER=029302266
60
+ # ALIGO_USER_ID=your-aligo-user-id
61
+ # ALIGO_API_KEY=your-aligo-api-key
62
+ # AWS_SNS_ACCESS_KEY=your-aws-access-key
63
+ # AWS_SNS_SECRET_KEY=your-aws-secret-key
64
+ # AWS_SNS_REGION=ap-northeast-2
65
+
66
+ # 카카오 알림톡 (configs/notification/alimtalk.json)
67
+ # ALIMTALK_SENDER_KEY=your-kakao-sender-key
68
+ # ALIGO_USER_ID=your-aligo-user-id
69
+ # ALIGO_API_KEY=your-aligo-api-key
@@ -0,0 +1,15 @@
1
+ {
2
+ "_comment": "CORS 설정 예시. cors_allow_origins 는 프로덕션에서 반드시 구체적인 도메인으로 제한하세요.",
3
+ "cors_enabled": true,
4
+ "cors_allow_credentials": false,
5
+ "cors_allow_headers": "Origin,Content-Type,Accept,Authorization,X-API-Key,X-Signature,X-Timestamp,X-Nonce,X-Transaction-ID",
6
+ "cors_allow_methods": "GET,POST,PUT,PATCH,DELETE,OPTIONS",
7
+ "cors_allow_origins": "https://your-domain.com",
8
+
9
+ "environments": {
10
+ "development": {
11
+ "_comment": "개발 환경에서만 와일드카드 허용",
12
+ "cors_allow_origins": "*"
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "enabled": false,
3
+ "default": "nice",
4
+ "request_ttl_sec": 300,
5
+ "result_ttl_sec": 600,
6
+ "return_url": "/v1/identity/callback",
7
+ "success_redirect_url": "/identity/complete",
8
+ "failure_redirect_url": "/identity/error",
9
+ "duplicate_ci_check": true,
10
+ "providers": [
11
+ {
12
+ "driver": "nice",
13
+ "site_code": "${NICE_SITE_CODE}",
14
+ "site_password": "${NICE_SITE_PASSWORD}",
15
+ "client_id": "${NICE_CLIENT_ID}",
16
+ "client_secret": "${NICE_CLIENT_SECRET}",
17
+ "product_id": "2101979031",
18
+ "api_url": "https://nice.checkplus.co.kr",
19
+ "token_url": "https://svc.niceapi.co.kr:22001/digital/niceid/oauth/oauth/token",
20
+ "crypto_url": "https://svc.niceapi.co.kr:22001/digital/niceid/api/v1.0/common/crypto/token"
21
+ }
22
+ ],
23
+ "rate_limit": {
24
+ "per_ip_per_hour": 10,
25
+ "per_account_per_day": 5
26
+ }
27
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "_comment": "JWT 설정 예시. secret 은 반드시 환경변수로 주입하세요. access_ttl_sec 은 보안 수준에 맞게 조정하세요.",
3
+ "enabled": true,
4
+ "secret": "${JWT_SECRET}",
5
+ "access_ttl_sec": 3600,
6
+ "refresh_ttl_sec": 1209600,
7
+ "issuer": "entity-server",
8
+ "algorithm": "HS256",
9
+
10
+ "_comment_algorithm": "지원 알고리즘: HS256 | HS384 | HS512 | RS256 | RS384 | RS512",
11
+ "_comment_ttl": "access_ttl_sec=3600(1시간), refresh_ttl_sec=1209600(14일) 기본값"
12
+ }
@@ -1,31 +1,34 @@
1
1
  {
2
2
  "_comment": "OAuth 2.0 설정 예시. 사용할 프로바이더만 남기고 실제 값으로 교체하세요.",
3
+ "enabled": false,
3
4
 
4
5
  "state_secret": "${OAUTH_STATE_SECRET}",
5
6
  "state_ttl_sec": 600,
7
+ "success_redirect_url": "/auth/callback",
8
+ "failure_redirect_url": "/auth/error",
6
9
 
7
10
  "providers": {
8
11
  "google": {
9
12
  "client_id": "${GOOGLE_CLIENT_ID}",
10
13
  "client_secret": "${GOOGLE_CLIENT_SECRET}",
11
- "redirect_url": "https://your-domain.com/v1/oauth/google/callback",
14
+ "redirect_url": "/v1/oauth/google/callback",
12
15
  "scopes": ["openid", "email", "profile"]
13
16
  },
14
17
  "github": {
15
18
  "client_id": "${GITHUB_CLIENT_ID}",
16
19
  "client_secret": "${GITHUB_CLIENT_SECRET}",
17
- "redirect_url": "https://your-domain.com/v1/oauth/github/callback"
20
+ "redirect_url": "/v1/oauth/github/callback"
18
21
  },
19
22
  "naver": {
20
23
  "client_id": "${NAVER_CLIENT_ID}",
21
24
  "client_secret": "${NAVER_CLIENT_SECRET}",
22
- "redirect_url": "https://your-domain.com/v1/oauth/naver/callback"
25
+ "redirect_url": "/v1/oauth/naver/callback"
23
26
  },
24
27
  "kakao": {
25
28
  "_comment": "Kakao — 커스텀 엔드포인트 예시",
26
29
  "client_id": "${KAKAO_CLIENT_ID}",
27
30
  "client_secret": "${KAKAO_CLIENT_SECRET}",
28
- "redirect_url": "https://your-domain.com/v1/oauth/kakao/callback",
31
+ "redirect_url": "/v1/oauth/kakao/callback",
29
32
  "auth_url": "https://kauth.kakao.com/oauth/authorize",
30
33
  "token_url": "https://kauth.kakao.com/oauth/token",
31
34
  "user_info_url": "https://kapi.kakao.com/v2/user/me",
@@ -0,0 +1,33 @@
1
+ {
2
+ "password_policy": {
3
+ "min_length": 8,
4
+ "require_mixed_case": false,
5
+ "require_number": false,
6
+ "require_special": false,
7
+ "history_count": 5
8
+ },
9
+ "admin_force_reset": {
10
+ "temp_password_length": 12,
11
+ "require_change": true,
12
+ "notify_email": true
13
+ },
14
+ "password_reset": {
15
+ "enabled": false,
16
+ "token_ttl_sec": 300,
17
+ "base_url": "/password-reset",
18
+ "rate_limit": {
19
+ "per_email_per_hour": 5,
20
+ "per_ip_per_minute": 10
21
+ }
22
+ },
23
+ "email_verification": {
24
+ "enabled": false,
25
+ "required": false,
26
+ "code_length": 6,
27
+ "code_ttl_sec": 300,
28
+ "max_attempts": 5,
29
+ "rate_limit": {
30
+ "per_email_per_hour": 5
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "_comment": "개인정보처리방침 설정 예시. 각 모듈은 독립적으로 enabled 설정 가능. 운영 적용 전 docs/security/privacy-policy-guide.md 를 반드시 확인하세요.",
3
+
4
+ "dormancy": {
5
+ "_comment": "휴면 계정 전환 정책. 마지막 로그인 기준으로 dormancy_days 경과 시 휴면 처리.",
6
+ "enabled": false,
7
+ "dormancy_days": 365,
8
+ "warning_days": [30, 7],
9
+ "email_template": "dormancy_warning",
10
+ "check_interval_hours": 24
11
+ },
12
+
13
+ "data_retention": {
14
+ "_comment": "개인정보 보존 기간 정책. action: anonymize(익명화) | delete(삭제).",
15
+ "enabled": false,
16
+ "retention_days": 1095,
17
+ "action": "anonymize",
18
+ "check_interval_hours": 24
19
+ },
20
+
21
+ "password_policy": {
22
+ "_comment": "비밀번호 만료/재사용 금지 정책. 복잡도 규칙은 password.json의 password_policy를 공통 사용.",
23
+ "enabled": false,
24
+ "max_age_days": 180,
25
+ "warning_days": [14, 7],
26
+ "email_template": "account/password_expiry_warning"
27
+ }
28
+ }
@@ -1,10 +1,12 @@
1
1
  {
2
- "enable_hmac": false,
2
+ "enable_hmac": true,
3
3
  "enable_rbac": true,
4
+ "enable_data_encryption": true,
4
5
  "enable_packet_encryption": false,
5
- "packet_magic_len": 4,
6
6
  "timestamp_skew_sec": 300,
7
7
  "nonce_ttl_sec": 300,
8
+ "auth_fail_limit_per_min": 120,
9
+ "auth_block_sec": 60,
8
10
  "nonce_store": {
9
11
  "driver": "redis",
10
12
  "memcache_servers": ["localhost:11211"],
@@ -0,0 +1,12 @@
1
+ {
2
+ "enabled": false,
3
+ "issuer": "EntityServer",
4
+ "enforce_roles": [],
5
+ "code_digits": 6,
6
+ "period_sec": 30,
7
+ "skew": 1,
8
+ "recovery_code_count": 10,
9
+ "setup_token_ttl_sec": 300,
10
+ "max_verify_attempts": 5,
11
+ "verify_lockout_sec": 300
12
+ }
@@ -1,17 +1,6 @@
1
- // ──────────────────────────────────────────────────────────────────────────
2
- // database.json 설정 예시 (주석 포함 예시 전용 파일 — 실제 파일은 순수 JSON)
3
- //
4
- // "default" : 사용할 그룹 이름 (groups 키 중 하나)
5
- // "groups" : 드라이버별 연결 설정 모음
6
- // driver : "mysql" | "postgres" | "mongodb" | "dynamodb" |
7
- // "firestore" | "scylladb" | "couchdb"
8
- //
9
- // 환경 변수 참조: "${ENV_VAR_NAME}" 형식으로 값을 주입합니다.
10
- // ──────────────────────────────────────────────────────────────────────────
11
1
  {
12
2
  "default": "development",
13
3
  "groups": {
14
- // ── MySQL (SQL) ─────────────────────────────────────────────────
15
4
  "development": {
16
5
  "driver": "mysql",
17
6
  "host": "${DB_HOST_DEVELOPMENT}",
@@ -33,154 +22,6 @@
33
22
  "maxOpenConns": 50,
34
23
  "maxIdleConns": 25,
35
24
  "connMaxLifetimeSec": 3600
36
- },
37
-
38
- // ── MongoDB ─────────────────────────────────────────────────────
39
- // URI 우선 사용. uri 가 없으면 host/port/database/username/password 조합.
40
- "mongodb_dev": {
41
- "driver": "mongodb",
42
- "uri": "mongodb://localhost:27017/entity_dev",
43
- "database": "entity_dev"
44
- },
45
- "mongodb_prod": {
46
- "driver": "mongodb",
47
- "host": "${MONGO_HOST}",
48
- "port": 27017,
49
- "database": "${MONGO_DB}",
50
- "username": "${MONGO_USER}",
51
- "password": "${MONGO_PASSWORD}",
52
- "uri": ""
53
- },
54
- "mongodb_replica": {
55
- "driver": "mongodb",
56
- "uri": "mongodb://${MONGO_USER}:${MONGO_PASS}@mongo1:27017,mongo2:27017,mongo3:27017/${MONGO_DB}?replicaSet=rs0&authSource=admin",
57
- "database": "${MONGO_DB}"
58
- },
59
-
60
- // ── Amazon DynamoDB ─────────────────────────────────────────────
61
- // region 과 IAM 인증이 필요합니다.
62
- // 로컬 테스트: endpoint 에 "http://localhost:8000" 지정.
63
- "dynamodb_dev": {
64
- "driver": "dynamodb",
65
- "region": "ap-northeast-2",
66
- "endpoint": "http://localhost:8000",
67
- "access_key_id": "${AWS_ACCESS_KEY_ID}",
68
- "secret_access_key": "${AWS_SECRET_ACCESS_KEY}"
69
- },
70
- "dynamodb_prod": {
71
- "driver": "dynamodb",
72
- "region": "${AWS_REGION}",
73
- "access_key_id": "${AWS_ACCESS_KEY_ID}",
74
- "secret_access_key": "${AWS_SECRET_ACCESS_KEY}"
75
- },
76
-
77
- // ── Google Cloud Firestore ──────────────────────────────────────
78
- // GCP 프로젝트 ID 와 서비스 계정 JSON 파일(또는 ADC)이 필요합니다.
79
- // credentials_file : 서비스 계정 키 파일 경로 (선택)
80
- // ADC 자동 사용 시 credentials_file 생략 가능.
81
- "firestore_dev": {
82
- "driver": "firestore",
83
- "project_id": "${GCP_PROJECT_ID}",
84
- "credentials_file": "${GOOGLE_APPLICATION_CREDENTIALS}"
85
- },
86
- "firestore_prod": {
87
- "driver": "firestore",
88
- "project_id": "${GCP_PROJECT_ID}"
89
- },
90
-
91
- // ── ScyllaDB / Apache Cassandra ────────────────────────────────
92
- // hosts 는 쉼표 구분 문자열 또는 배열 모두 허용합니다.
93
- // keyspace 가 없으면 자동 생성됩니다.
94
- "scylladb_dev": {
95
- "driver": "scylladb",
96
- "hosts": "localhost:9042",
97
- "keyspace": "entity_dev",
98
- "username": "",
99
- "password": ""
100
- },
101
- "scylladb_prod": {
102
- "driver": "scylladb",
103
- "hosts": "${SCYLLA_HOSTS}",
104
- "keyspace": "${SCYLLA_KEYSPACE}",
105
- "username": "${SCYLLA_USER}",
106
- "password": "${SCYLLA_PASSWORD}",
107
- "consistency": "quorum",
108
- "timeout": "10s"
109
- },
110
-
111
- // ── Apache CouchDB ──────────────────────────────────────────────
112
- // URI 우선 사용. uri 가 없으면 host/port/username/password 조합.
113
- // 포트 기본값: 5984
114
- "couchdb_dev": {
115
- "driver": "couchdb",
116
- "host": "localhost",
117
- "port": 5984,
118
- "username": "admin",
119
- "password": "password"
120
- },
121
- "couchdb_uri": {
122
- "driver": "couchdb",
123
- "uri": "http://admin:password@localhost:5984/"
124
- },
125
- "couchdb_prod": {
126
- "driver": "couchdb",
127
- "uri": "http://${COUCH_USER}:${COUCH_PASS}@${COUCH_HOST}:${COUCH_PORT}/"
128
25
  }
129
26
  }
130
27
  }
131
-
132
- // ──────────────────────────────────────────────────────────────────────────
133
- // DataStore 단독 사용 — flat 형식 (groups 없이 최상위에 driver 직접 지정)
134
- //
135
- // SQL 없이 NoSQL DataStore만 단독으로 사용할 때는 groups 없이
136
- // database.json 최상위에 driver 를 직접 지정합니다.
137
- // store_loader.go 가 groups 키가 없고 NoSQL driver 인 경우에만 DataStore로 인식합니다.
138
- // ──────────────────────────────────────────────────────────────────────────
139
-
140
- // MongoDB flat 형식
141
- {
142
- "driver": "mongodb",
143
- "uri": "mongodb://localhost:27017",
144
- "database": "entity_server"
145
- }
146
-
147
- // MongoDB — 환경변수 방식
148
- {
149
- "driver": "mongodb",
150
- "host": "${MONGO_HOST}",
151
- "port": "${MONGO_PORT}",
152
- "username": "${MONGO_USER}",
153
- "password": "${MONGO_PASSWORD}",
154
- "database": "${MONGO_DATABASE}"
155
- }
156
-
157
- // DynamoDB flat 형식
158
- {
159
- "driver": "dynamodb",
160
- "region": "${AWS_REGION}",
161
- "access_key_id": "${AWS_ACCESS_KEY_ID}",
162
- "secret_access_key": "${AWS_SECRET_ACCESS_KEY}"
163
- }
164
-
165
- // Firestore flat 형식
166
- {
167
- "driver": "firestore",
168
- "project_id": "${GCP_PROJECT_ID}",
169
- "credentials_file": "${GOOGLE_APPLICATION_CREDENTIALS}"
170
- }
171
-
172
- // ScyllaDB flat 형식
173
- {
174
- "driver": "scylladb",
175
- "host": "${SCYLLA_HOST}",
176
- "port": 9042,
177
- "database": "${SCYLLA_KEYSPACE}",
178
- "username": "${SCYLLA_USER}",
179
- "password": "${SCYLLA_PASSWORD}"
180
- }
181
-
182
- // CouchDB flat 형식
183
- {
184
- "driver": "couchdb",
185
- "uri": "http://${COUCH_USER}:${COUCH_PASS}@${COUCH_HOST}:5984/"
186
- }
@@ -0,0 +1,186 @@
1
+ // ──────────────────────────────────────────────────────────────────────────
2
+ // database.json 설정 예시 (주석 포함 예시 전용 파일 — 실제 파일은 순수 JSON)
3
+ //
4
+ // "default" : 사용할 그룹 이름 (groups 키 중 하나)
5
+ // "groups" : 드라이버별 연결 설정 모음
6
+ // driver : "mysql" | "postgres" | "mongodb" | "dynamodb" |
7
+ // "firestore" | "scylladb" | "couchdb"
8
+ //
9
+ // 환경 변수 참조: "${ENV_VAR_NAME}" 형식으로 값을 주입합니다.
10
+ // ──────────────────────────────────────────────────────────────────────────
11
+ {
12
+ "default": "development",
13
+ "groups": {
14
+ // ── MySQL (SQL) ─────────────────────────────────────────────────
15
+ "development": {
16
+ "driver": "mysql",
17
+ "host": "${DB_HOST_DEVELOPMENT}",
18
+ "port": "${DB_PORT_DEVELOPMENT}",
19
+ "database": "${DB_NAME_DEVELOPMENT}",
20
+ "user": "${DB_USER_DEVELOPMENT}",
21
+ "password": "${DB_PASSWORD_DEVELOPMENT}",
22
+ "maxOpenConns": 20,
23
+ "maxIdleConns": 10,
24
+ "connMaxLifetimeSec": 3600
25
+ },
26
+ "production": {
27
+ "driver": "mysql",
28
+ "host": "${DB_HOST_PRODUCTION}",
29
+ "port": "${DB_PORT_PRODUCTION}",
30
+ "database": "${DB_NAME_PRODUCTION}",
31
+ "user": "${DB_USER_PRODUCTION}",
32
+ "password": "${DB_PASSWORD_PRODUCTION}",
33
+ "maxOpenConns": 50,
34
+ "maxIdleConns": 25,
35
+ "connMaxLifetimeSec": 3600
36
+ },
37
+
38
+ // ── MongoDB ─────────────────────────────────────────────────────
39
+ // URI 우선 사용. uri 가 없으면 host/port/database/username/password 조합.
40
+ "mongodb_dev": {
41
+ "driver": "mongodb",
42
+ "uri": "mongodb://localhost:27017/entity_dev",
43
+ "database": "entity_dev"
44
+ },
45
+ "mongodb_prod": {
46
+ "driver": "mongodb",
47
+ "host": "${MONGO_HOST}",
48
+ "port": 27017,
49
+ "database": "${MONGO_DB}",
50
+ "username": "${MONGO_USER}",
51
+ "password": "${MONGO_PASSWORD}",
52
+ "uri": ""
53
+ },
54
+ "mongodb_replica": {
55
+ "driver": "mongodb",
56
+ "uri": "mongodb://${MONGO_USER}:${MONGO_PASS}@mongo1:27017,mongo2:27017,mongo3:27017/${MONGO_DB}?replicaSet=rs0&authSource=admin",
57
+ "database": "${MONGO_DB}"
58
+ },
59
+
60
+ // ── Amazon DynamoDB ─────────────────────────────────────────────
61
+ // region 과 IAM 인증이 필요합니다.
62
+ // 로컬 테스트: endpoint 에 "http://localhost:8000" 지정.
63
+ "dynamodb_dev": {
64
+ "driver": "dynamodb",
65
+ "region": "ap-northeast-2",
66
+ "endpoint": "http://localhost:8000",
67
+ "access_key_id": "${AWS_ACCESS_KEY_ID}",
68
+ "secret_access_key": "${AWS_SECRET_ACCESS_KEY}"
69
+ },
70
+ "dynamodb_prod": {
71
+ "driver": "dynamodb",
72
+ "region": "${AWS_REGION}",
73
+ "access_key_id": "${AWS_ACCESS_KEY_ID}",
74
+ "secret_access_key": "${AWS_SECRET_ACCESS_KEY}"
75
+ },
76
+
77
+ // ── Google Cloud Firestore ──────────────────────────────────────
78
+ // GCP 프로젝트 ID 와 서비스 계정 JSON 파일(또는 ADC)이 필요합니다.
79
+ // credentials_file : 서비스 계정 키 파일 경로 (선택)
80
+ // ADC 자동 사용 시 credentials_file 생략 가능.
81
+ "firestore_dev": {
82
+ "driver": "firestore",
83
+ "project_id": "${GCP_PROJECT_ID}",
84
+ "credentials_file": "${GOOGLE_APPLICATION_CREDENTIALS}"
85
+ },
86
+ "firestore_prod": {
87
+ "driver": "firestore",
88
+ "project_id": "${GCP_PROJECT_ID}"
89
+ },
90
+
91
+ // ── ScyllaDB / Apache Cassandra ────────────────────────────────
92
+ // hosts 는 쉼표 구분 문자열 또는 배열 모두 허용합니다.
93
+ // keyspace 가 없으면 자동 생성됩니다.
94
+ "scylladb_dev": {
95
+ "driver": "scylladb",
96
+ "hosts": "localhost:9042",
97
+ "keyspace": "entity_dev",
98
+ "username": "",
99
+ "password": ""
100
+ },
101
+ "scylladb_prod": {
102
+ "driver": "scylladb",
103
+ "hosts": "${SCYLLA_HOSTS}",
104
+ "keyspace": "${SCYLLA_KEYSPACE}",
105
+ "username": "${SCYLLA_USER}",
106
+ "password": "${SCYLLA_PASSWORD}",
107
+ "consistency": "quorum",
108
+ "timeout": "10s"
109
+ },
110
+
111
+ // ── Apache CouchDB ──────────────────────────────────────────────
112
+ // URI 우선 사용. uri 가 없으면 host/port/username/password 조합.
113
+ // 포트 기본값: 5984
114
+ "couchdb_dev": {
115
+ "driver": "couchdb",
116
+ "host": "localhost",
117
+ "port": 5984,
118
+ "username": "admin",
119
+ "password": "password"
120
+ },
121
+ "couchdb_uri": {
122
+ "driver": "couchdb",
123
+ "uri": "http://admin:password@localhost:5984/"
124
+ },
125
+ "couchdb_prod": {
126
+ "driver": "couchdb",
127
+ "uri": "http://${COUCH_USER}:${COUCH_PASS}@${COUCH_HOST}:${COUCH_PORT}/"
128
+ }
129
+ }
130
+ }
131
+
132
+ // ──────────────────────────────────────────────────────────────────────────
133
+ // DataStore 단독 사용 — flat 형식 (groups 없이 최상위에 driver 직접 지정)
134
+ //
135
+ // SQL 없이 NoSQL DataStore만 단독으로 사용할 때는 groups 없이
136
+ // database.json 최상위에 driver 를 직접 지정합니다.
137
+ // store_loader.go 가 groups 키가 없고 NoSQL driver 인 경우에만 DataStore로 인식합니다.
138
+ // ──────────────────────────────────────────────────────────────────────────
139
+
140
+ // MongoDB flat 형식
141
+ {
142
+ "driver": "mongodb",
143
+ "uri": "mongodb://localhost:27017",
144
+ "database": "entity_server"
145
+ }
146
+
147
+ // MongoDB — 환경변수 방식
148
+ {
149
+ "driver": "mongodb",
150
+ "host": "${MONGO_HOST}",
151
+ "port": "${MONGO_PORT}",
152
+ "username": "${MONGO_USER}",
153
+ "password": "${MONGO_PASSWORD}",
154
+ "database": "${MONGO_DATABASE}"
155
+ }
156
+
157
+ // DynamoDB flat 형식
158
+ {
159
+ "driver": "dynamodb",
160
+ "region": "${AWS_REGION}",
161
+ "access_key_id": "${AWS_ACCESS_KEY_ID}",
162
+ "secret_access_key": "${AWS_SECRET_ACCESS_KEY}"
163
+ }
164
+
165
+ // Firestore flat 형식
166
+ {
167
+ "driver": "firestore",
168
+ "project_id": "${GCP_PROJECT_ID}",
169
+ "credentials_file": "${GOOGLE_APPLICATION_CREDENTIALS}"
170
+ }
171
+
172
+ // ScyllaDB flat 형식
173
+ {
174
+ "driver": "scylladb",
175
+ "host": "${SCYLLA_HOST}",
176
+ "port": 9042,
177
+ "database": "${SCYLLA_KEYSPACE}",
178
+ "username": "${SCYLLA_USER}",
179
+ "password": "${SCYLLA_PASSWORD}"
180
+ }
181
+
182
+ // CouchDB flat 형식
183
+ {
184
+ "driver": "couchdb",
185
+ "uri": "http://${COUCH_USER}:${COUCH_PASS}@${COUCH_HOST}:5984/"
186
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ "enabled": false,
3
+
4
+ "data": {
5
+ "enabled": true,
6
+ "schedule": "0 2 * * *",
7
+ "db_groups": ["default"],
8
+ "entities": {
9
+ "include": [],
10
+ "exclude": [],
11
+ "exclude_patterns": ["*_log"]
12
+ },
13
+ "include_history": false,
14
+ "format": "jsonl",
15
+ "compress": true,
16
+ "encrypt_passphrase": "${BACKUP_ENCRYPT_KEY}",
17
+ "batch_size": 500,
18
+ "max_concurrent_entities": 3,
19
+ "retention": {
20
+ "keep_count": 7,
21
+ "keep_days": 30
22
+ }
23
+ },
24
+
25
+ "files": {
26
+ "enabled": true,
27
+ "mode": "realtime",
28
+ "max_retries": 3,
29
+ "retry_interval_sec": 60
30
+ },
31
+
32
+ "schema": {
33
+ "enabled": true
34
+ },
35
+
36
+ "target": {
37
+ "storage_key": "s3-backup",
38
+ "prefix": "backups"
39
+ },
40
+
41
+ "notification": {
42
+ "on_success": false,
43
+ "on_failure": true,
44
+ "channels": ["log", "smtp"]
45
+ }
46
+ }