diff --git a/src/nginxconfig/templates/domain_sections/https.vue b/src/nginxconfig/templates/domain_sections/https.vue index e76ddbd..d77f265 100644 --- a/src/nginxconfig/templates/domain_sections/https.vue +++ b/src/nginxconfig/templates/domain_sections/https.vue @@ -46,9 +46,9 @@
- (http://{{ $parent.$props.data.server.domain.value }} + (http://{{ $parent.$props.data.server.domain.computed }} - https://{{ $parent.$props.data.server.domain.value }}) + https://{{ $parent.$props.data.server.domain.computed }})
@@ -122,7 +122,7 @@ @@ -139,7 +139,7 @@ @@ -156,7 +156,7 @@ diff --git a/src/nginxconfig/templates/domain_sections/server.vue b/src/nginxconfig/templates/domain_sections/server.vue index 9d8d8d1..de831f0 100644 --- a/src/nginxconfig/templates/domain_sections/server.vue +++ b/src/nginxconfig/templates/domain_sections/server.vue @@ -33,7 +33,7 @@
- (www.{{ domain }}) + (www.{{ $props.data.domain.computed }})
@@ -51,7 +51,7 @@
- (cdn.{{ domain }}) + (cdn.{{ $props.data.domain.computed }})
@@ -69,9 +69,9 @@
- ({{ wwwSubdomain ? `${domain}, ` : '' }}*.{{ domain }} + ({{ wwwSubdomain ? `${domain}, ` : '' }}*.{{ $props.data.domain.computed }} - {{ wwwSubdomain ? 'www.' : '' }}{{ domain }}) + {{ wwwSubdomain ? 'www.' : '' }}{{ $props.data.domain.computed }})
@@ -168,6 +168,22 @@ }, computed: computedFromDefaults(defaults, 'server'), // Getters & setters for the delegated data watch: { + '$props.data.domain': { + handler(data) { + // This might cause recursion, but seems not to + + // Ignore www. if given + if (data.computed.startsWith('www.')) { + data.computed = data.computed.slice(4); + } + + // Use default if empty + if (!data.computed.trim()) { + data.computed = data.default; + } + }, + deep: true, + }, // Only allow CDN when WWW is enabled first '$props.data.wwwSubdomain': { handler(data) {