Add hostname configuration option

This commit is contained in:
2025-04-01 22:36:28 +02:00
parent d46e9a3faf
commit fc302d8ef2
3 changed files with 3 additions and 2 deletions

View File

@@ -230,7 +230,7 @@ const app = new Elysia()
.execute(); .execute();
} }
return redirect(config.NODE_ENV === "production" ? "https://music.renati.me/" : "http://localhost:5173/", 303) as unknown as void; return redirect(config.NODE_ENV === "production" ? `https://${config.HOSTNAME}/` : "http://localhost:5173/", 303) as unknown as void;
}, { }, {
response: { response: {
303: t.Void(), 303: t.Void(),

View File

@@ -7,7 +7,7 @@ import { Db } from "./services/db";
import { Session } from "./services/session"; import { Session } from "./services/session";
export const OAUTH_SCOPE = "email offline_access openid profile https://graph.microsoft.com/User.Read.All"; export const OAUTH_SCOPE = "email offline_access openid profile https://graph.microsoft.com/User.Read.All";
export const REDIRECT_URI = config.NODE_ENV === "production" ? "https://music.renati.me/api/v1/login" : "http://localhost:3000/api/v1/login"; export const REDIRECT_URI = config.NODE_ENV === "production" ? `https://${config.HOSTNAME}/api/v1/login` : "http://localhost:3000/api/v1/login";
export const EXPIRATION_BUFFER = Duration.seconds(10); export const EXPIRATION_BUFFER = Duration.seconds(10);

View File

@@ -13,6 +13,7 @@ export const Config = Schema.Struct({
Schema.String, Schema.String,
Schema.optional, Schema.optional,
), ),
HOSTNAME: Schema.String,
NODE_ENV: pipe( NODE_ENV: pipe(
Schema.Literal("development", "production"), Schema.Literal("development", "production"),
Schema.optionalWith({ default: constant("development" as const) }), Schema.optionalWith({ default: constant("development" as const) }),