# EN: Shared configuration for all GoodGo staging services
# VI: Cau hinh chung cho tat ca cac service staging cua GoodGo
apiVersion: v1
kind: ConfigMap
metadata:
  name: goodgo-config
  namespace: staging
  labels:
    environment: staging
    platform: goodgo
data:
  # EN: ASP.NET Core Configuration
  # VI: Cau hinh ASP.NET Core
  ASPNETCORE_ENVIRONMENT: "Staging"
  ASPNETCORE_URLS: "http://+:8080"

  # EN: JWT Configuration (shared across all services)
  # VI: Cau hinh JWT (dung chung cho tat ca services)
  # EN: Use external HTTPS URL so RequireHttpsMetadata=true is valid.
  #     Services resolve OIDC discovery over public TLS endpoint via Traefik.
  # VI: Dùng HTTPS external URL để RequireHttpsMetadata=true hoạt động đúng.
  #     Các service lấy OIDC discovery qua endpoint TLS công khai qua Traefik.
  Jwt__Authority: "https://api.staging.goodgo.vn"
  Jwt__Audience: "goodgo-api"
  # EN: MUST be true in staging/prod — never allow HTTP metadata endpoints outside dev
  # VI: PHẢI là true trong staging/prod — không cho phép HTTP metadata endpoint ngoài môi trường dev
  Jwt__RequireHttpsMetadata: "true"

  # EN: Service Discovery URLs (K8s DNS: {service-name}.staging.svc.cluster.local)
  # VI: URL tim kiem service (K8s DNS: {service-name}.staging.svc.cluster.local)
  IamService__BaseUrl: "http://iam-service:8080"
  MerchantService__BaseUrl: "http://merchant-service:8080"
  CatalogService__BaseUrl: "http://catalog-service:8080"
  OrderService__BaseUrl: "http://order-service:8080"
  InventoryService__BaseUrl: "http://inventory-service:8080"
  WalletService__BaseUrl: "http://wallet-service:8080"
  StorageService__BaseUrl: "http://storage-service:8080"
  FnbEngine__BaseUrl: "http://fnb-engine:8080"

  # EN: Redis Configuration
  # VI: Cau hinh Redis
  Redis__Host: "redis"
  Redis__Port: "6379"
  Redis__Database: "0"

  # EN: CORS Configuration
  # VI: Cau hinh CORS
  Cors__AllowedOrigins: "https://pos.staging.goodgo.vn,https://staging.goodgo.vn,https://admin.staging.goodgo.vn"

  # EN: Logging
  # VI: Ghi log
  Serilog__MinimumLevel__Default: "Information"
  Serilog__MinimumLevel__Override__Microsoft: "Warning"
  Serilog__MinimumLevel__Override__System: "Warning"

  # EN: Feature Flags
  # VI: Tinh nang bat/tat
  Features__SwaggerEnabled: "true"
  Features__DetailedErrors: "false"

  # EN: API Version
  # VI: Phien ban API
  API_VERSION: "v1"
