Commit ded99522 authored by Ralf's avatar Ralf
Browse files

director: factor out region-to-domain mapping

parent 46cd9e0f
const regions = {
"saarbruecken": {
domain: "sb",
switch_date: -1,
},
"st-wendel": {
domain: "wnd",
switch_date: -1,
},
"merzig-wadern": {
domain: "mzg",
switch_date: -1,
},
"neunkirchen": {
domain: "nk",
switch_date: -1,
},
"saarlouis": {
domain: "sls",
switch_date: -1,
},
"saarpfalz": {
domain: "hom",
switch_date: -1,
},
}
const http = require("http")
const fs = require("fs")
......@@ -39,13 +66,10 @@ const server = http.createServer(async (req, res) => {
}
}
if (result.node_information.region) {
switch (result.node_information.region) {
case "saarbruecken": result.node_information.domain.name = "sb"; break
case "st-wendel": result.node_information.domain.name = "wnd"; break
case "merzig-wadern": result.node_information.domain.name = "mzg"; break
case "neunkirchen": result.node_information.domain.name = "nk"; break
case "saarlouis": result.node_information.domain.name = "sls"; break
case "saarpfalz": result.node_information.domain.name = "hom"; break
const region_info = regions[result.node_information.region]
if (region_info) {
result.node_information.domain.name = region_info.domain
result.node_information.switch_time = region_info.switch_time
}
}
res.writeHead(200)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment