mirror of
https://github.com/digitalocean/nginxconfig.io.git
synced 2025-08-11 12:52:13 +08:00
Even more confs!
This commit is contained in:
11
src/nginxconfig/util/common_hsts.js
Normal file
11
src/nginxconfig/util/common_hsts.js
Normal file
@@ -0,0 +1,11 @@
|
||||
export default domains => {
|
||||
return domains.every(d => d.https.hsts.computed)
|
||||
&& (
|
||||
domains.every(d => d.https.hstsSubdomains.computed)
|
||||
|| domains.every(d => !d.https.hstsSubdomains.computed)
|
||||
)
|
||||
&& (
|
||||
domains.every(d => d.https.hstsPreload.computed)
|
||||
|| domains.every(d => !d.https.hstsPreload.computed)
|
||||
);
|
||||
};
|
19
src/nginxconfig/util/get_ssl_certificate.js
Normal file
19
src/nginxconfig/util/get_ssl_certificate.js
Normal file
@@ -0,0 +1,19 @@
|
||||
export const getSslCertificate = (domain, global) => {
|
||||
if (domain.https.certType.computed === 'letsEncrypt')
|
||||
`/etc/letsencrypt/live/${domain.server.domain.computed}/fullchain.pem`;
|
||||
|
||||
if (domain.https.sslCertificate.computed)
|
||||
return domain.https.sslCertificate.computed;
|
||||
|
||||
return `${global.nginx.nginxConfigDirectory.computed.replace(/\/+$/, '')}/ssl/${domain.server.domain.computed}.crt`;
|
||||
};
|
||||
|
||||
export const getSslCertificateKey = (domain, global) => {
|
||||
if (domain.https.certType.computed === 'letsEncrypt')
|
||||
`/etc/letsencrypt/live/${domain.server.domain.computed}/privkey.pem`;
|
||||
|
||||
if (domain.https.sslCertificateKey.computed)
|
||||
return domain.https.sslCertificateKey.computed;
|
||||
|
||||
return `${global.nginx.nginxConfigDirectory.computed.replace(/\/+$/, '')}/ssl/${domain.server.domain.computed}.key`;
|
||||
};
|
Reference in New Issue
Block a user