# 환경변수 매핑 테이블

## 1. user-service 환경변수 매핑

| 환경변수 | 값 | 지정 객체 | 비고 |
|---------|-----|----------|------|
| SERVER_PORT | 8081 | cm-user-service | |
| DB_URL | jdbc:postgresql://user-postgresql:5432/userdb | cm-user-service | |
| DB_DRIVER | org.postgresql.Driver | cm-user-service | |
| DB_HOST | user-postgresql | cm-user-service | ClusterIP 서비스명 |
| DB_PORT | 5432 | cm-user-service | |
| DB_NAME | userdb | cm-user-service | |
| DB_USERNAME | eventuser | cm-user-service | |
| DB_PASSWORD | Hi5Jessica! | secret-user-service | |
| DB_KIND | postgresql | cm-user-service | |
| DDL_AUTO | update | cm-common | 공통 |
| SHOW_SQL | false | cm-common | 공통 |
| JPA_DIALECT | org.hibernate.dialect.PostgreSQLDialect | cm-common | 공통 |
| H2_CONSOLE_ENABLED | false | cm-common | 공통 |
| REDIS_ENABLED | true | cm-common | 공통 |
| REDIS_HOST | redis | cm-common | ClusterIP 서비스명, 공통 |
| REDIS_PORT | 6379 | cm-common | 공통 |
| REDIS_PASSWORD | Hi5Jessica! | secret-common | 공통 |
| REDIS_DATABASE | 0 | cm-user-service | |
| EXCLUDE_REDIS | "" | cm-common | 공통 |
| KAFKA_BOOTSTRAP_SERVERS | 20.249.182.13:9095,4.217.131.59:9095 | cm-common | 공통 |
| KAFKA_CONSUMER_GROUP | user-service-consumers | cm-user-service | |
| EXCLUDE_KAFKA | "" | cm-common | 공통 |
| JWT_SECRET | ShiBpV6q7NwnjOafujT87XcgxzTdEFmEKO5Y+8zNPvE= | secret-common | openssl 생성, 공통 |
| JWT_ACCESS_TOKEN_VALIDITY | 604800000 | cm-common | 공통 |
| CORS_ALLOWED_ORIGINS | http://localhost:8081,http://localhost:8082,http://localhost:8083,http://localhost:8084,http://kt-event-marketing.20.214.196.128.nip.io | cm-common | 공통 |
| LOG_LEVEL_APP | INFO | cm-common | 공통 |
| LOG_LEVEL_WEB | INFO | cm-common | 공통 |
| LOG_LEVEL_SQL | WARN | cm-common | 공통 |
| LOG_LEVEL_SQL_TYPE | WARN | cm-common | 공통 |
| LOG_FILE_PATH | logs/user-service.log | cm-user-service | |

## 2. event-service 환경변수 매핑

| 환경변수 | 값 | 지정 객체 | 비고 |
|---------|-----|----------|------|
| SERVER_PORT | 8080 | cm-event-service | |
| DB_HOST | event-postgresql | cm-event-service | ClusterIP 서비스명 |
| DB_PORT | 5432 | cm-event-service | |
| DB_NAME | eventdb | cm-event-service | |
| DB_USERNAME | eventuser | cm-event-service | |
| DB_PASSWORD | Hi5Jessica! | secret-event-service | |
| DDL_AUTO | update | cm-common | 공통 |
| REDIS_HOST | redis | cm-common | ClusterIP 서비스명, 공통 |
| REDIS_PORT | 6379 | cm-common | 공통 |
| REDIS_PASSWORD | Hi5Jessica! | secret-common | 공통 |
| REDIS_DATABASE | 2 | cm-event-service | |
| KAFKA_BOOTSTRAP_SERVERS | 20.249.182.13:9095,4.217.131.59:9095 | cm-common | 공통 |
| KAFKA_CONSUMER_GROUP | event-service-consumers | cm-event-service | |
| CONTENT_SERVICE_URL | http://content-service | cm-event-service | |
| DISTRIBUTION_SERVICE_URL | http://distribution-service | cm-event-service | |
| JWT_SECRET | ShiBpV6q7NwnjOafujT87XcgxzTdEFmEKO5Y+8zNPvE= | secret-common | 공통 |
| LOG_LEVEL | INFO | cm-event-service | |
| SQL_LOG_LEVEL | WARN | cm-event-service | |

## 3. ai-service 환경변수 매핑

| 환경변수 | 값 | 지정 객체 | 비고 |
|---------|-----|----------|------|
| SERVER_PORT | 8083 | cm-ai-service | |
| REDIS_HOST | redis | cm-common | ClusterIP 서비스명, 공통 |
| REDIS_PORT | 6379 | cm-common | 공통 |
| REDIS_PASSWORD | Hi5Jessica! | secret-common | 공통 |
| REDIS_DATABASE | 3 | cm-ai-service | |
| REDIS_TIMEOUT | 3000 | cm-ai-service | |
| REDIS_POOL_MAX | 8 | cm-common | 공통 |
| REDIS_POOL_IDLE | 8 | cm-common | 공통 |
| REDIS_POOL_MIN | 2 | cm-ai-service | |
| REDIS_POOL_WAIT | -1ms | cm-common | 공통 |
| KAFKA_BOOTSTRAP_SERVERS | 20.249.182.13:9095,4.217.131.59:9095 | cm-common | 공통 |
| KAFKA_CONSUMER_GROUP | ai-service-consumers | cm-ai-service | |
| KAFKA_TOPICS_AI_JOB | ai-event-generation-job | cm-ai-service | |
| KAFKA_TOPICS_AI_JOB_DLQ | ai-event-generation-job-dlq | cm-ai-service | |
| JWT_SECRET | ShiBpV6q7NwnjOafujT87XcgxzTdEFmEKO5Y+8zNPvE= | secret-common | 공통 |
| JWT_ACCESS_TOKEN_VALIDITY | 604800000 | cm-common | 공통 |
| JWT_REFRESH_TOKEN_VALIDITY | 86400 | cm-common | 공통 |
| CORS_ALLOWED_ORIGINS | http://localhost:8081,http://localhost:8082,http://localhost:8083,http://localhost:8084,http://kt-event-marketing.20.214.196.128.nip.io | cm-common | 공통 |
| CORS_ALLOWED_METHODS | GET,POST,PUT,DELETE,OPTIONS,PATCH | cm-common | 공통 |
| CORS_ALLOWED_HEADERS | * | cm-common | 공통 |
| CORS_ALLOW_CREDENTIALS | true | cm-common | 공통 |
| CORS_MAX_AGE | 3600 | cm-common | 공통 |
| LOG_LEVEL_ROOT | INFO | cm-common | 공통 |
| LOG_LEVEL_AI | DEBUG | cm-ai-service | |
| LOG_LEVEL_KAFKA | INFO | cm-ai-service | |
| LOG_LEVEL_REDIS | INFO | cm-ai-service | |
| LOG_LEVEL_RESILIENCE4J | DEBUG | cm-ai-service | |
| LOG_FILE_NAME | logs/ai-service.log | cm-ai-service | |
| LOG_FILE_MAX_SIZE | 10MB | cm-common | 공통 |
| LOG_FILE_MAX_HISTORY | 7 | cm-common | 공통 |
| LOG_FILE_TOTAL_CAP | 100MB | cm-common | 공통 |
| AI_PROVIDER | CLAUDE | cm-ai-service | |
| AI_CLAUDE_API_URL | https://api.anthropic.com/v1/messages | cm-ai-service | |
| AI_CLAUDE_API_KEY | sk-ant-api03-... | secret-ai-service | |
| AI_CLAUDE_ANTHROPIC_VERSION | 2023-06-01 | cm-ai-service | |
| AI_CLAUDE_MODEL | claude-sonnet-4-5-20250929 | cm-ai-service | |
| AI_CLAUDE_MAX_TOKENS | 4096 | cm-ai-service | |
| AI_CLAUDE_TEMPERATURE | 0.7 | cm-ai-service | |
| AI_CLAUDE_TIMEOUT | 300000 | cm-ai-service | |
| CACHE_TTL_RECOMMENDATION | 86400 | cm-ai-service | |
| CACHE_TTL_JOB_STATUS | 86400 | cm-ai-service | |
| CACHE_TTL_TREND | 3600 | cm-ai-service | |
| CACHE_TTL_FALLBACK | 604800 | cm-ai-service | |

## 4. content-service 환경변수 매핑

| 환경변수 | 값 | 지정 객체 | 비고 |
|---------|-----|----------|------|
| SERVER_PORT | 8084 | cm-content-service | application.yml 기본값 |
| REDIS_ENABLED | true | cm-common | 공통 |
| REDIS_HOST | redis | cm-common | ClusterIP 서비스명, 공통 |
| REDIS_PORT | 6379 | cm-common | 공통 |
| REDIS_PASSWORD | Hi5Jessica! | secret-common | 공통 |
| REDIS_TIMEOUT | 2000ms | cm-common | 공통 |
| REDIS_POOL_MAX | 8 | cm-common | 공통 |
| REDIS_POOL_IDLE | 8 | cm-common | 공통 |
| REDIS_POOL_MIN | 0 | cm-common | 공통 |
| REDIS_POOL_WAIT | -1ms | cm-common | 공통 |
| REDIS_DATABASE | 1 | cm-content-service | |
| JWT_SECRET | ShiBpV6q7NwnjOafujT87XcgxzTdEFmEKO5Y+8zNPvE= | secret-common | 공통 |
| JWT_ACCESS_TOKEN_VALIDITY | 604800000 | cm-common | 공통 (실제 3600000) |
| JWT_REFRESH_TOKEN_VALIDITY | 86400 | cm-common | 공통 (실제 604800000) |
| AZURE_STORAGE_CONNECTION_STRING | DefaultEndpointsProtocol=https;AccountName=... | secret-content-service | |
| AZURE_CONTAINER_NAME | content-images | cm-content-service | |
| REPLICATE_API_URL | https://api.replicate.com | cm-content-service | |
| REPLICATE_API_TOKEN | (값 없음) | secret-content-service | |
| REPLICATE_MODEL_VERSION | stability-ai/sdxl:... | cm-content-service | |
| CORS_ALLOWED_ORIGINS | http://localhost:8081,http://localhost:8082,http://localhost:8083,http://localhost:8084,http://kt-event-marketing.20.214.196.128.nip.io | cm-common | 공통 |
| LOG_LEVEL_APP | INFO | cm-common | 공통 (실제 DEBUG) |
| LOG_LEVEL_WEB | INFO | cm-common | 공통 |
| LOG_LEVEL_ROOT | INFO | cm-common | 공통 |
| LOG_FILE_PATH | logs/content-service.log | cm-content-service | |
| LOG_FILE_MAX_SIZE | 10MB | cm-common | 공통 |
| LOG_FILE_MAX_HISTORY | 7 | cm-common | 공통 |
| LOG_FILE_TOTAL_CAP | 100MB | cm-common | 공통 |

## 5. participation-service 환경변수 매핑

| 환경변수 | 값 | 지정 객체 | 비고 |
|---------|-----|----------|------|
| SERVER_PORT | 8084 | cm-participation-service | |
| DB_HOST | participation-postgresql | cm-participation-service | ClusterIP 서비스명 |
| DB_PORT | 5432 | cm-participation-service | |
| DB_NAME | participationdb | cm-participation-service | |
| DB_USERNAME | eventuser | cm-participation-service | |
| DB_PASSWORD | Hi5Jessica! | secret-participation-service | |
| DDL_AUTO | update | cm-common | 공통 |
| SHOW_SQL | false | cm-participation-service | |
| REDIS_HOST | redis | cm-common | ClusterIP 서비스명, 공통 |
| REDIS_PORT | 6379 | cm-common | 공통 |
| REDIS_PASSWORD | Hi5Jessica! | secret-common | 공통 |
| REDIS_DATABASE | 4 | cm-participation-service | |
| KAFKA_BOOTSTRAP_SERVERS | 20.249.182.13:9095,4.217.131.59:9095 | cm-common | 공통 |
| KAFKA_CONSUMER_GROUP | participation-service-consumers | cm-participation-service | |
| JWT_SECRET | ShiBpV6q7NwnjOafujT87XcgxzTdEFmEKO5Y+8zNPvE= | secret-common | 공통 |
| JWT_EXPIRATION | 86400000 | JWT_ACCESS_TOKEN_VALIDITY 대체 | |
| LOG_LEVEL | INFO | cm-participation-service | |
| LOG_FILE | logs/participation-service.log | cm-participation-service | |

## 6. analytics-service 환경변수 매핑

| 환경변수 | 값 | 지정 객체 | 비고 |
|---------|-----|----------|------|
| SERVER_PORT | 8086 | cm-analytics-service | |
| DB_KIND | postgresql | cm-common | 공통 |
| DB_HOST | analytic-postgresql | cm-analytics-service | ClusterIP 서비스명 |
| DB_PORT | 5432 | cm-analytics-service | |
| DB_NAME | analytics_db | cm-analytics-service | 실행프로파일은 analyticdb |
| DB_USERNAME | analytics_user | cm-analytics-service | 실행프로파일은 eventuser |
| DB_PASSWORD | Hi5Jessica! | secret-analytics-service | |
| DDL_AUTO | update | cm-analytics-service | 실행프로파일은 create |
| SHOW_SQL | false | cm-analytics-service | 실행프로파일은 true |
| REDIS_HOST | redis | cm-common | ClusterIP 서비스명, 공통 |
| REDIS_PORT | 6379 | cm-common | 공통 |
| REDIS_PASSWORD | Hi5Jessica! | secret-common | 공통 |
| REDIS_DATABASE | 5 | cm-analytics-service | |
| KAFKA_ENABLED | true | cm-analytics-service | |
| KAFKA_BOOTSTRAP_SERVERS | 20.249.182.13:9095,4.217.131.59:9095 | cm-common | 공통 |
| KAFKA_CONSUMER_GROUP_ID | analytics-service | cm-analytics-service | 실행프로파일은 analytics-service-consumers |
| SAMPLE_DATA_ENABLED | true | cm-analytics-service | |
| JWT_SECRET | ShiBpV6q7NwnjOafujT87XcgxzTdEFmEKO5Y+8zNPvE= | secret-common | 공통 |
| JWT_ACCESS_TOKEN_VALIDITY | 604800000 | cm-common | 실행프로파일은 1800 |
| JWT_REFRESH_TOKEN_VALIDITY | 86400 | cm-common | 실행프로파일은 86400 |
| CORS_ALLOWED_ORIGINS | http://localhost:8081,http://localhost:8082,http://localhost:8083,http://localhost:8084,http://kt-event-marketing.20.214.196.128.nip.io | cm-common | 공통 |
| LOG_FILE | logs/analytics-service.log | cm-analytics-service | |
| LOG_LEVEL_APP | INFO | cm-common | 실행프로파일은 DEBUG |
| LOG_LEVEL_WEB | INFO | cm-common | 공통 |
| LOG_LEVEL_SQL | WARN | cm-common | 실행프로파일은 DEBUG |
| LOG_LEVEL_SQL_TYPE | WARN | cm-common | 실행프로파일은 TRACE |

## 주요 체크 사항

### 1. ClusterIP 서비스명 사용 확인
- ✅ Redis HOST: `redis` (ClusterIP 서비스명)
- ✅ user-service DB HOST: `user-postgresql`
- ✅ event-service DB HOST: `event-postgresql`
- ✅ participation-service DB HOST: `participation-postgresql`
- ✅ analytics-service DB HOST: `analytic-postgresql`

### 2. Secret에 stringData 사용 확인
- ✅ secret-common.yaml: stringData 사용
- ✅ secret-user-service.yaml: stringData 사용
- ✅ secret-event-service.yaml: stringData 사용
- ✅ secret-ai-service.yaml: stringData 사용
- ✅ secret-content-service.yaml: stringData 사용
- ✅ secret-participation-service.yaml: stringData 사용
- ✅ secret-analytics-service.yaml: stringData 사용

### 3. JWT_SECRET openssl 생성 확인
- ✅ openssl rand -base64 32로 생성: `ShiBpV6q7NwnjOafujT87XcgxzTdEFmEKO5Y+8zNPvE=`

### 4. 매니페스트 내 환경변수 미사용 확인
- ✅ Ingress host: kt-event-marketing-api.20.214.196.128.nip.io (실제 값 사용)
- ✅ 모든 매니페스트에 실제 값만 지정

### 5. Image Pull Secret 설정 확인
- ✅ secret-imagepull.yaml: USERNAME과 PASSWORD 실제 값 지정
- ✅ Deployment에 imagePullSecrets 설정

### 6. Image명 형식 확인
- ✅ 형식: acrdigitalgarage01.azurecr.io/kt-event-marketing/{서비스명}:latest

### 7. Ingress 설정 확인
- ✅ Ingress External IP: 20.214.196.128
- ✅ Service port: 80
- ✅ Ingress annotation에 rewrite-target 설정 없음

### 8. envFrom 사용 확인
- ✅ 모든 Deployment에서 env 대신 envFrom 사용

### 9. REDIS_DATABASE 서비스별 분리 확인
- ✅ user-service: 0
- ✅ content-service: 1
- ✅ event-service: 2
- ✅ ai-service: 3
- ✅ participation-service: 4
- ✅ analytics-service: 5

### 10. 보안 환경변수 Secret 분리 확인
- ✅ JWT_SECRET: secret-common
- ✅ REDIS_PASSWORD: secret-common
- ✅ DB_PASSWORD: 각 서비스별 secret
- ✅ AI_CLAUDE_API_KEY: secret-ai-service
- ✅ AZURE_STORAGE_CONNECTION_STRING: secret-content-service
