Last active
December 16, 2015 18:29
-
-
Save tgvashworth/5478385 to your computer and use it in GitHub Desktop.
local tld dreamcode/ideas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Array | |
// pros: | |
// simple, no duplication of ports | |
// cons: | |
// a tld can be duplicated | |
{ | |
6000: [ | |
"api.name.dev", | |
"admin.name.dev" | |
], | |
6001: [ | |
"name.dev", | |
"www.name.dev" | |
] | |
} | |
// Namespace | |
// pros: | |
// powerful + flexible? | |
// cons: | |
// empty-string isn't great | |
// hard to detect duplicated ports | |
{ | |
"name.dev": { | |
6000: ['api', 'admin'], | |
6001: ['', 'www'] | |
}, | |
"other.dev": { | |
6002: '' // this one's not great | |
}, | |
"another.dev": { | |
6003: ['', 'api', 'www', 'admin'] | |
}, | |
"more.dev": { | |
6004: '', | |
6005: 'api', | |
6006: 'www', | |
6007: 'admin' | |
} | |
} | |
// Distra-inspired (https://github.com/phuu/distra) | |
// pros: | |
// very simple | |
{ | |
"api.name.dev": "localhost:6000", | |
// or maybe... | |
"admin.name.dev": 6000, | |
"name.dev": "localhost:6001", | |
"www.name.dev": 6001 | |
} |
The other requirement for me for local-tld is that it doesn't wipe out other vhosts (it seems to wipe out distra, for example).
I chose to make ports the top level object keys because they need to be system-unique.
the port: [array] mapping seems to make sense, the current format was evolved, aliases are an add-on done in way that I didn’t have to change much in hoodie, happy to revise this now.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Worth noting that the array version is (almost) the last example inverted (values as keys & vice versa)