apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
  name: wallet
spec:
  replicas: 1
  selector:
    matchLabels:
      app: wallet
  template:
    metadata:
      labels:
        app: wallet
    spec:      
      containers:
      - image: DOCKERHUB/wallet.backend.wallet:0.1.44
        name: wallet
        volumeMounts:
        - name: google-application-credentials
          mountPath: "/etc/GOOGLE_APPLICATION_CREDENTIALS"
          readOnly: true
        resources:
          requests:
            cpu: "50m"
        env:     
        # EVENT STORE CONFIG 
        - name: GOOGLE_APPLICATION_CREDENTIALS
          value: /etc/GOOGLE_APPLICATION_CREDENTIALS/gcloud-service-key.json  
        - name: EVENT_STORE_BROKER_TYPE
          value: PUBSUB
        - name: EVENT_STORE_BROKER_EVENTS_TOPIC
          value: events
        - name: EVENT_STORE_STORE_TYPE
          value: MONGO
        - name: EVENT_STORE_STORE_URL
          value: mongodb://dbevents-0.dbevents:27017,dbevents-1.dbevents:27017,dbevents-2.dbevents:27017/test?replicaSet=rs0
        - name: EVENT_STORE_STORE_AGGREGATES_DB_NAME
          value: Aggregates
        - name: EVENT_STORE_STORE_EVENTSTORE_DB_NAME
          value: EventStore
        # INTERNAL MONGO DB CONFIG
        - name: MONGODB_URL
          value: mongodb://wall-mongo:27017
        - name: MONGODB_DB_NAME
          value: wallet
        # JWT CONGIF        
        - name: JWT_PUBLIC_KEY
          valueFrom:
            configMapKeyRef:
              name: keycloak-jwt-public-key
              key: jwt_public_key
        # API - EMI-GATEWAY CONFIG
        - name: EMI-GATEWAY_REPLIES_TOPIC_SUBSCRIPTION
          value: emi-gateway-replies-topic-mbe-wallet
        - name: REPLY_TIMEOUT
          value: '2000'
        - name: BROKER_TYPE
          value: PUBSUB
        # RESET LOCK INITIALIZE BACKED
        - name: LOCKVERSION
          value: "08_04_19__01"
        # PRODUCTS AND CONCEPTS TYPES
        - name: WALLET_TRANSACTION_TYPES_CONCEPTS
          value: '{"PURCHASE": ["VEHICLE_SUBSCRIPTION"], "MOVEMENT": ["DEPOSIT", "DRIVER_PAYMENT_FOR_APP_CLIENT_SERVICE", "APP_DRIVER_AGREEMENT_PAYMENT", "WALLET_RECHARGE", "WITHDRAWAL", "CLIENT_AGREEMENT_PAYMENT", "CLIENT_AGREEMENT_REFUND", "PAY_PER_SERVICE", "PAY_PER_SERVICE_REFUND" ]}'
        # BACKEND PARAMETERS
        - name: GMT_TO_SERVE
          value: "GMT-5"
        
      volumes:
      - name: google-application-credentials
        secret:
          secretName: google-application-credentials
      