apiVersion: v1
kind: ConfigMap
metadata:
  name: git-server-nginx-conf
data:
  nginx.conf: |
    user                    nginx;
    worker_processes        4;
    pid                     /run/nginx.pid;

    events {
        worker_connections    1024;
    }

    http {
        include               /etc/nginx/mime.types;
        default_type          application/octet-stream;

        access_log            /dev/stdout;
        error_log             /dev/stderr;

        gzip                  on;

        server {
            server_name       _;
            listen 80         default_server;
            listen [::]:80    default_server;

            location /ping {
                default_type text/plain;
                return 200 'pong';
            }

            location ~ ^.*\.git/* {
                include         fastcgi_params;
                fastcgi_param   SCRIPT_FILENAME /usr/libexec/git-core/git-http-backend;
                fastcgi_param   GIT_HTTP_EXPORT_ALL "";
                fastcgi_param   GIT_PROJECT_ROOT /var/lib/git;
                fastcgi_param   PATH_INFO $uri;
                fastcgi_param   REMOTE_USER $remote_user;
                fastcgi_pass    127.0.0.1:9000;
            }

            location / {
                return 404;
            }
        }
    }
