mirror of
https://github.com/zkldi/Tachi.git
synced 2026-09-28 01:48:11 +03:00
Add TACHI_SERVER_STUPID_INTERNAL_DOCKER_HACK_LOCATION
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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}`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user