refactor(guild): prefix environment variables with FABRIC_BACKEND_GUILD

This commit is contained in:
nav
2026-05-13 12:58:32 +00:00
parent 392534a6ac
commit fdb661f32b
5 changed files with 30 additions and 30 deletions

View File

@@ -1,7 +1,7 @@
export async function introspectGuildToken(token: string): Promise<{ active: boolean; user?: { id: string; email?: string } }> {
const centerBaseUrl = process.env.CENTER_BASE_URL;
const guildNodeId = process.env.GUILD_NODE_ID;
const centerApiKey = process.env.CENTER_API_KEY;
const centerBaseUrl = process.env.FABRIC_BACKEND_GUILD_CENTER_BASE_URL;
const guildNodeId = process.env.FABRIC_BACKEND_GUILD_NODE_ID;
const centerApiKey = process.env.FABRIC_BACKEND_GUILD_CENTER_API_KEY;
if (!centerBaseUrl || !guildNodeId || !centerApiKey) {
return { active: false };

View File

@@ -11,11 +11,11 @@ import { IdempotencyRecord } from './entities/idempotency-record.entity';
export const buildTypeOrmConfig = (): TypeOrmModuleOptions => ({
type: 'mysql',
host: process.env.DB_HOST ?? 'mysql-guild',
port: Number(process.env.DB_PORT ?? 3306),
username: process.env.DB_USER ?? 'fabric',
password: process.env.DB_PASSWORD ?? 'fabric',
database: process.env.DB_NAME ?? 'fabric_guild',
host: process.env.FABRIC_BACKEND_GUILD_DB_HOST ?? 'mysql-guild',
port: Number(process.env.FABRIC_BACKEND_GUILD_DB_PORT ?? 3306),
username: process.env.FABRIC_BACKEND_GUILD_DB_USER ?? 'fabric',
password: process.env.FABRIC_BACKEND_GUILD_DB_PASSWORD ?? 'fabric',
database: process.env.FABRIC_BACKEND_GUILD_DB_NAME ?? 'fabric_guild',
entities: [
Guild,
Channel,
@@ -27,6 +27,6 @@ export const buildTypeOrmConfig = (): TypeOrmModuleOptions => ({
GuildMemberRole,
IdempotencyRecord,
],
synchronize: (process.env.DB_SYNC ?? 'true') === 'true',
logging: (process.env.DB_LOGGING ?? 'false') === 'true',
synchronize: (process.env.FABRIC_BACKEND_GUILD_DB_SYNC ?? 'true') === 'true',
logging: (process.env.FABRIC_BACKEND_GUILD_DB_LOGGING ?? 'false') === 'true',
});

View File

@@ -15,9 +15,9 @@ function requireEnv(name: string): string {
}
function validateEnv(): void {
requireEnv('CENTER_BASE_URL');
requireEnv('CENTER_API_KEY');
requireEnv('GUILD_NODE_ID');
requireEnv('FABRIC_BACKEND_GUILD_CENTER_BASE_URL');
requireEnv('FABRIC_BACKEND_GUILD_CENTER_API_KEY');
requireEnv('FABRIC_BACKEND_GUILD_NODE_ID');
}
async function bootstrap() {
@@ -43,7 +43,7 @@ async function bootstrap() {
const swaggerDoc = SwaggerModule.createDocument(app, swaggerConfig);
SwaggerModule.setup('docs', app, swaggerDoc);
const port = process.env.PORT ? Number(process.env.PORT) : 7002;
const port = process.env.FABRIC_BACKEND_GUILD_PORT ? Number(process.env.FABRIC_BACKEND_GUILD_PORT) : 7002;
await app.listen(port);
console.log(`Fabric.Backend.Guild listening on :${port}`);
}