mirror of
https://github.com/digitalocean/nginxconfig.io
synced 2024-11-10 04:24:12 +00:00
Fix dupe domain name issues
This commit is contained in:
parent
7905593480
commit
4e34a9b6a9
2 changed files with 17 additions and 7 deletions
|
@ -70,8 +70,8 @@ limitations under the License.
|
|||
<div :class="`column ${splitColumn ? 'is-half' : 'is-full'} is-full-mobile is-full-tablet`">
|
||||
<h2>{{ i18n.templates.app.configFiles }}</h2>
|
||||
<div ref="files" class="columns is-multiline">
|
||||
<NginxPrism v-for="conf in confFilesOutput"
|
||||
:key="`${conf[0]}-${hash(conf[1])}`"
|
||||
<NginxPrism v-for="(conf, i) in confFilesOutput"
|
||||
:key="`${conf[0]}-${i}-${hash(conf[1])}`"
|
||||
:name="`${nginxDir}/${conf[0]}`"
|
||||
:conf="conf[1]"
|
||||
:half="confFilesOutput.length > 1 && !splitColumn"
|
||||
|
@ -169,7 +169,18 @@ limitations under the License.
|
|||
return '';
|
||||
},
|
||||
add() {
|
||||
this.$data.domains.push(clone(Domain.delegated));
|
||||
const data = clone(Domain.delegated);
|
||||
|
||||
// Avoid dupe domains
|
||||
let count = 1;
|
||||
while (this.$data.domains.some(d => d && d.server.domain.computed === data.server.domain.computed)) {
|
||||
count++;
|
||||
data.server.domain.computed = data.server.domain.default.replace('.com', `${count}.com`);
|
||||
}
|
||||
data.server.domain.value = data.server.domain.computed;
|
||||
|
||||
// Store
|
||||
this.$data.domains.push(data);
|
||||
this.$data.active = this.$data.domains.length - 1;
|
||||
},
|
||||
remove(index) {
|
||||
|
|
|
@ -182,15 +182,14 @@ limitations under the License.
|
|||
i18n,
|
||||
};
|
||||
},
|
||||
computed: computedFromDefaults(defaults, 'server'), // Getters & setters for the delegated data
|
||||
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
|
||||
// Ignore www. if given, enable WWW subdomain
|
||||
if (data.computed.startsWith('www.')) {
|
||||
data.computed = data.computed.slice(4);
|
||||
this.wwwSubdomain = true;
|
||||
}
|
||||
|
||||
// Use default if empty
|
||||
|
|
Loading…
Reference in a new issue