x-templates:
  # `x-templates` field contains reusable templates for metadata extraction services that user can define under `services` field.
  # See docker-compose docs on re-using configuration fragments: https://docs.docker.com/compose/compose-file/compose-file-v3/#extension-fields
  cognos: &cognos-defaults #  Cognos default environment variables
    OUTPUT_PREFIX: /output/extract
    EXCLUDE_FILTER: '{}'
    INCLUDE_FILTER: '{"team_folders": {}}'
    COGNOS_CONFIG: "/run/secrets/cognos_config"

  extract-cognos-service: &extract
    image: cognos-extractor-master
    command:
      - "python"
      - "-m"
      - "marketplace_scripts.cognos.offline_extractor.main"
    privileged: false
    network_mode: host
    environment:
      <<: *cognos-defaults
    secrets:
      - cognos_config

# Create a separate service for each Cognos connection:
services:
  # Example Cognos connection
  cognos-example:
    <<: *extract
    environment:
      <<: *cognos-defaults
      # Filter out Cognos Assets based on folders.
      EXCLUDE_FILTER: '{}'
      INCLUDE_FILTER: '{"team_folders": {}}'
    volumes:
      # You can change './output/cognos-example' to any output location you want.
      # The contents under './output/cognos-example' folder should be uploaded as it is to s3 bucket for processing of Cognos Assets.
      - ./output/cognos-example:/output/extract

secrets:
  cognos_config:
    # Change it to the actual location of your cognos.ini file
    file: ./cognos.ini