chore: make docker
This commit is contained in:
@@ -66,6 +66,17 @@ function getEnvOrDefault(key: string, defaultValue: string): string {
|
||||
return Bun.env[key] ?? defaultValue;
|
||||
}
|
||||
|
||||
function getFirstEnvOrDefault(keys: string[], defaultValue: string): string {
|
||||
for (const key of keys) {
|
||||
const value = Bun.env[key];
|
||||
if (value !== undefined) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
function getBooleanEnvOrDefault(key: string, defaultValue: boolean): boolean {
|
||||
const raw = Bun.env[key];
|
||||
if (raw === undefined) {
|
||||
@@ -112,7 +123,7 @@ export const config: BotConfig = {
|
||||
temperature: parseFloat(getEnvOrDefault("AI_TEMPERATURE", "1.2")),
|
||||
},
|
||||
replicate: {
|
||||
apiKey: getEnvOrDefault("REPLICATE_API_KEY", ""),
|
||||
apiKey: getFirstEnvOrDefault(["REPLICATE_API_KEY", "REPLICATE_API_TOKEN"], ""),
|
||||
},
|
||||
fal: {
|
||||
apiKey: getEnvOrDefault("FAL_KEY", ""),
|
||||
|
||||
@@ -23,6 +23,7 @@ import type { FSWatcher } from "fs";
|
||||
|
||||
const logger = createLogger("Main");
|
||||
let webCssWatcher: FSWatcher | null = null;
|
||||
const isProduction = Bun.env.NODE_ENV === "production";
|
||||
|
||||
// Create the Discord client with required intents
|
||||
const client = new BotClient({
|
||||
@@ -53,7 +54,9 @@ async function main(): Promise<void> {
|
||||
|
||||
// Start web server after bot is logged in
|
||||
await buildWebCss();
|
||||
webCssWatcher = startWebCssWatcher();
|
||||
if (!isProduction) {
|
||||
webCssWatcher = startWebCssWatcher();
|
||||
}
|
||||
await startWebServer(client);
|
||||
} catch (error) {
|
||||
logger.error("Failed to start bot", error);
|
||||
|
||||
Reference in New Issue
Block a user