/**
 * turns a domain config to two config files for nginx web sever on proxmox and its container
 * @param domainConfig
 * @returns {{homeNginxConf: string, containerNginxConf: string}}
 */
export function makeHostFileForSymfony(domainConfig){
	const model = {
		noContainerNginxConf: ``,
		homeNginxConf : `
# ---------------- ${domainConfig.name} -------------------------
# ---------- un site utilisant Symfony --------------------------

server {
        server_name ${domainConfig.name};
        listen 80 http2;
        return 301 https://${domainConfig.name}$request_uri;

}

server {
        listen 443 ssl http2;
        listen [::]:443 ssl http2;

        server_name ${domainConfig.name};
       ${domainConfig.disableSSL ? '#' : ''} ssl_certificate /etc/letsencrypt/live/${domainConfig.name}-0001/fullchain.pem;
       ${domainConfig.disableSSL ? '#' : ''} ssl_certificate_key /etc/letsencrypt/live/${domainConfig.name}-0001/privkey.pem;
                add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
        location / {
                proxy_set_header   X-Forwarded-For $remote_addr;
                proxy_set_header   Host $http_host;
                # redirection to containter
                proxy_pass         http://${domainConfig.LXCcontainerLocalIP};
        }

        add_header Permissions-Policy "interest-cohort=()";

}
`,
		containerNginxConf : `server {
    if ($host = ${domainConfig.domain}) {
        return 301 https://$host$request_uri;
    }


    listen 80 ;
    listen [::]:80 ;
    server_name ${domainConfig.domain};
    # enforce https
    return 301 https://$server_name$request_uri;

    add_header Permissions-Policy "interest-cohort=()";
    root /home/www/tykayn/${domainConfig.domain}/;
    index index.php index.html;

}
# ========================== ${domainConfig.name} | fin ================ #
`
	}
	return model;
}