---
apiVersion: v1
kind: ConfigMap
metadata:
  name: adm-frontend
  namespace: persagy
  labels:
    name: adm-frontend
data:
  nginx.conf: |
    #user tony;
    worker_processes 4;
    error_log /var/log/nginx/error.log;
    pid /run/nginx.pid;
    worker_rlimit_nofile 100001;
    # Load dynamic modules. See /usr/share/nginx/README.dynamic.
    include /usr/share/nginx/modules/*.conf;

    events {
        worker_connections 1024;
    }

    http {
        log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                          '$status $body_bytes_sent "$http_referer" '
                          '"$http_user_agent" "$http_x_forwarded_for" "$request_time"';

        access_log  /var/log/nginx/access.log  main;

        sendfile            on;
        tcp_nopush          on;
        tcp_nodelay         on;
        keepalive_timeout   65;
        types_hash_max_size 2048;

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

        gzip  on;
        gzip_min_length 1k;
        gzip_buffers 4 16k;
        gzip_http_version 1.1;
        gzip_comp_level 2;
        gzip_types text/plain application/x-javascript application/css  text/css application/xml text/javascript application/x-httpd-php
        gzip_vary on;

        server {
            listen 80 default_server;
            root /usr/persagy/saas-web;

            # FMS
            location /admplus {
                try_files $uri $uri/ /adm-frontend/index.html;
            }
    
            location @rewrites {
                rewrite ^(.+)$ /index.html last;
            }

            location ~* \.(?:ico|css|js|woff|eot|otf|ttf)$ {
                # Some basic cache-control for static files to be sent to the browser
                add_header  Access-Control-Allow-Origin *;
            }
            location ~index.html
            {
                    add_header Cache-Control no-cache;
            }
        }

    }
  vue.config.js: |
    module.exports = {
        devServer: {
            proxy: {
                '/admplus': {
                    target: 'http://adm-frontend:8838',
                },
            },
        },
    }