Add TACHI_SERVER_STUPID_INTERNAL_DOCKER_HACK_LOCATION

This commit is contained in:
zkldi
2022-03-25 04:31:33 +00:00
parent 80b0623842
commit 62b9410e23
2 changed files with 14 additions and 1 deletions
+13
View File
@@ -21,6 +21,13 @@ const logger = CreateLayeredLogger(LoggerLayers.botConfigSetup);
export interface BotConfig {
TACHI_SERVER_LOCATION: string;
// our docker setup is ruined and means we can't pass "bokutachi.xyz" as the
// server location, because docker reads /etc/hosts from another container and
// decides that should resolve to some random internal IP.
// this is stupid.
// i want to remove this hack.
// if you provide this URL, that will be used instead for lookups.
TACHI_SERVER_STUPID_INTERNAL_DOCKER_HACK_LOCATION: string;
HTTP_SERVER: {
URL: string;
};
@@ -50,6 +57,7 @@ function ParseBotConfig(fileLoc = "conf.json5"): BotConfig {
const err = p(data, {
TACHI_SERVER_LOCATION: "string",
TACHI_SERVER_STUPID_INTERNAL_DOCKER_HACK_LOCATION: "*string",
HTTP_SERVER: {
URL: "string",
},
@@ -87,6 +95,11 @@ function ParseBotConfig(fileLoc = "conf.json5"): BotConfig {
throw err;
}
// if no stupid hack docker location is set, use tachi_server_location instead.
if (!data.TACHI_SERVER_STUPID_INTERNAL_DOCKER_HACK_LOCATION) {
data.TACHI_SERVER_STUPID_INTERNAL_DOCKER_HACK_LOCATION = data.TACHI_SERVER_LOCATION;
}
return data;
}
+1 -1
View File
@@ -124,7 +124,7 @@ export function PrependTachiUrl(url: string, version: "1" = "1"): string {
url = `/${url}`;
}
return `${BotConfig.TACHI_SERVER_LOCATION}/api/v${version}${url}`;
return `${BotConfig.TACHI_SERVER_STUPID_INTERNAL_DOCKER_HACK_LOCATION}/api/v${version}${url}`;
}
/**