apiVersion: v1
kind: ConfigMap
metadata:
  name: datastat-configmap
  namespace: opendesign-datapertus
data:
  default.conf: |
    # openeuler
    server {
      # listen 443 ssl;
      # server_name localhost;
      # charset utf-8;

      listen 8080;
      server_name datastat.openeuler.org;
      charset utf-8;
      limit_conn perserver 50;
      if ($request_method = 'OPTIONS') {
        return 401;
      }

      location / {
        location /assets {
          # publish every two weeks
          expires 14d;
          add_header Cache-Control public;
        }
        location / {
          add_header Cache-Control no-cache;
        }
        root /usr/share/nginx/html/openeuler;
        index index.html;
        #   error_page 404 /404.html;
      }


      location ~ ^/(en|zh)/(overview|detail|mobile|about) {
        try_files $uri /index.html;
      }

      error_page 500 501 502 503 504 505 /500.html;
      error_page 401 /401.html;
      error_page 404 /404.html;

      location = /401.html {
        root /usr/share/nginx/html;
      }

      location = /404.html {
        root /usr/share/nginx/html;
      }

      location = /500.html {
        root /usr/share/nginx/html;
      }
    }

    # mindspore
    server {
      # listen 443 ssl;
      # server_name localhost;
      # charset utf-8;

      listen 8080;
      server_name datastat.mindspore.cn;
      charset utf-8;
      limit_conn perserver 50;
      if ($request_method = 'OPTIONS') {
        return 401;
      }

      location / {
        location /mindspore/assets {
          # publish every two weeks
          expires 14d;
          add_header Cache-Control public;
        }
        location /mindspore {
          add_header Cache-Control no-cache;
        }
        root /usr/share/nginx/html/mindspore;
        index index.html;
        #   error_page 404 /404.html;
      }

      location ~ ^/(en|zh)/(overview|detail|mobile|about) {
        try_files $uri /index.html;
      }

      error_page 500 501 502 503 504 505 /500.html;
      error_page 401 /401.html;
      error_page 404 /404.html;

      location = /401.html {
        root /usr/share/nginx/html;
      }

      location = /404.html {
        root /usr/share/nginx/html;
      }

      location = /500.html {
        root /usr/share/nginx/html;
      }
    }

    # opengauss
    server {
      # listen 443 ssl;
      # server_name localhost;
      # charset utf-8;

      listen 8080;
      server_name datastat.opengauss.org;
      charset utf-8;
      limit_conn perserver 50;
      if ($request_method = 'OPTIONS') {
        return 401;
      }

      location / {
        location /opengauss/assets {
          # publish every two weeks
          expires 14d;
          add_header Cache-Control public;
        }
        location /opengauss {
          add_header Cache-Control no-cache;
        }
        root /usr/share/nginx/html/opengauss;
        index index.html;
        #   error_page 404 /404.html;
      }

      location ~ ^/(en|zh)/(overview|detail|mobile|about) {
        try_files $uri /index.html;
      }

      error_page 500 501 502 503 504 505 /500.html;
      error_page 401 /401.html;
      error_page 404 /404.html;

      location = /401.html {
        root /usr/share/nginx/html;
      }

      location = /404.html {
        root /usr/share/nginx/html;
      }

      location = /500.html {
        root /usr/share/nginx/html;
      }
    }

    # openlookeng
    server {
      # listen 443 ssl;
      # server_name localhost;
      # charset utf-8;

      listen 8080;
      server_name datastat.openlookeng.io;
      charset utf-8;
      limit_conn perserver 50;
      if ($request_method = 'OPTIONS') {
        return 401;
      }

      location / {
        location /openlookeng/assets {
          # publish every two weeks
          expires 14d;
          add_header Cache-Control public;
        }
        location /openlookeng {
          add_header Cache-Control no-cache;
        }
        root /usr/share/nginx/html/openlookeng;
        index index.html;
        #   error_page 404 /404.html;
      }

      location ~ ^/(en|zh)/(overview|detail|mobile|about) {
        try_files $uri /index.html;
      }

      error_page 500 501 502 503 504 505 /500.html;
      error_page 401 /401.html;
      error_page 404 /404.html;

      location = /401.html {
        root /usr/share/nginx/html;
      }

      location = /404.html {
        root /usr/share/nginx/html;
      }

      location = /500.html {
        root /usr/share/nginx/html;
      }
    }