Skip to content

Instantly share code, notes, and snippets.

@tgvashworth
Last active December 16, 2015 18:29
Show Gist options
  • Save tgvashworth/5478385 to your computer and use it in GitHub Desktop.
Save tgvashworth/5478385 to your computer and use it in GitHub Desktop.
local tld dreamcode/ideas
// 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
}
@tgvashworth
Copy link
Author

Worth noting that the array version is (almost) the last example inverted (values as keys & vice versa)

@tgvashworth
Copy link
Author

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).

@janl
Copy link

janl commented Apr 30, 2013

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