apiVersion: v1
kind: ConfigMap
metadata:
  name: backstage-app-config
  namespace: backstage
data:
  app-config.yaml: |
    app:
      title: Backstage AllardDCS
      baseUrl: https://backstage-dev.allarddcs.nl
      extensions:
        - entity-content:kubernetes/kubernetes

    backend:
      baseUrl: https://backstage-dev.allarddcs.nl
      env:
        PATH: /usr/local/bin:$PATH
      listen:
        port: 7007
      cors:
        origin: https://backstage-dev.allarddcs.nl
        methods: [GET, POST, PUT, DELETE, PATCH]
        credentials: true
      csp:
        connect-src: ["'self'", "http:", "https:"]
      database:
        client: pg
        connection:
          host: ${POSTGRES_SERVICE_HOST}
          port: ${POSTGRES_SERVICE_PORT}
          user: ${POSTGRES_USER}
          password: ${POSTGRES_PASSWORD}
          database: ${POSTGRES_DB}
      reading:
        allow:
          - host: raw.githubusercontent.com
            paths:
              - /
      cache:
        memory: {}
      trustProxy: true
      log:
        level: debug

    logging:
      logLevel: info
      loggers:
        catalog:
          level: debug
        backend:
          level: debug
    techdocs:
      builder: 'local'
      publisher:
        type: 'local'
      generator:
        runIn: local

    organization:
      name: AllardDCS

    permission:
      rules:
        - allow:
            users:
              - AllardKrings

    integrations:
      gitea:
        - host: gitea-dev.allarddcs.nl
          baseUrl: https://gitea-dev.allarddcs.nl
          apiBaseUrl: https://gitea-dev.allarddcs.nl/api/v1
          token:
            $env: GITEA_TOKEN
      github:
        - host: github.com
          token:
            $env: GITHUB_TOKEN

    catalog:
      providers:
        github:
          myGithub:
            organization: 'AllardKrings'
            catalogPath: '/**/catalog-info.yaml'
            filters:
              branch: 'master'
              repository: 'kubernetes'
            schedule:
              frequency: { minutes: 30 }
              timeout: { minutes: 3 }

        gitea:
          myGitea:
            organization: 'allarddcs'
            host: gitea-dev.allarddcs.nl
            branch: 'master'
            catalogPath: '/**/catalog-info.yaml'
            schedule:
              frequency: { minutes: 30 }
              timeout: { minutes: 3 }

      locations:
        - type: url
          target: https://gitea-dev.allarddcs.nl/AllardDCS/kubernetes/raw/branch/master/group.yaml
          rules:
            - allow: [Group]
        - type: file
          target: /backstage/catalog/private-users/allardkrings.yaml
          rules:
            - allow: [User]
      processors:
        gitea:
          - host: gitea-dev.allarddcs.nl
            apiBaseUrl: https://gitea-dev.allarddcs.nl/api/v1

    kubernetes:
      serviceLocatorMethod:
        type: multiTenant
      clusterLocatorMethods:
        - type: config
          clusters:
            - name: local-cluster
              url: https://kubernetes.default.svc
              authProvider: serviceAccount
    auth:
      # see https://backstage.io/docs/auth/ to learn about auth providers
      environment: development
      providers:
        # See https://backstage.io/docs/auth/guest/provider
        guest: {}
        github:
          development:
            clientId: Ov23lilVTWftNp9vMFwB
            clientSecret: a687566a8d4871d30fe0126f150515531969d5fc
            usePopup: false
            signIn:
              resolvers:
                # Matches the GitHub username with the Backstage user entity name.
                # See https://backstage.io/docs/auth/github/provider#resolvers for more resolvers.
                - resolver: usernameMatchingUserEntityName


