Embed base images into binary
Include resource directory Ran `deno fmt` with 4 space indent, that changed every file (!!!!!) various changes
This commit is contained in:
45
src/db.ts
45
src/db.ts
@@ -6,16 +6,16 @@ import chalk from "npm:chalk@^5.3.0";
|
||||
const log = new Logging("Redis");
|
||||
|
||||
const config = Config.getConfig();
|
||||
if (typeof config == 'undefined') {
|
||||
if (typeof config == "undefined") {
|
||||
log.e(`Cannot start: Redis configuration failed`);
|
||||
Deno.exit(1);
|
||||
}
|
||||
|
||||
let shuttingDown = false;
|
||||
Deno.addSignalListener('SIGINT', () => {
|
||||
Deno.addSignalListener("SIGINT", () => {
|
||||
if (shuttingDown) return;
|
||||
shuttingDown = true;
|
||||
log.n('Disconnecting from Redis');
|
||||
log.n("Disconnecting from Redis");
|
||||
Database.quit();
|
||||
});
|
||||
|
||||
@@ -25,30 +25,37 @@ export const Database = new Redis({
|
||||
username: config.redis.username == "" ? undefined : config.redis.username,
|
||||
password: config.redis.password == "" ? undefined : config.redis.password,
|
||||
db: config.redis.db,
|
||||
lazyConnect: true
|
||||
lazyConnect: true,
|
||||
});
|
||||
Database.on('connect', async () => {
|
||||
Database.on("connect", async () => {
|
||||
log.i(`Connected to Redis`);
|
||||
|
||||
if (Deno.args.includes('--db-flush')) await Database.flushall(() => {
|
||||
log.w(`${chalk.inverse('The database was flushed.')}`);
|
||||
});
|
||||
if (Deno.args.includes("--db-flush")) {
|
||||
await Database.flushall(() => {
|
||||
log.w(`${chalk.inverse("The database was flushed.")}`);
|
||||
});
|
||||
}
|
||||
});
|
||||
Database.on('connecting', () => {
|
||||
log.n('Connecting to Redis..');
|
||||
Database.on("connecting", () => {
|
||||
log.n("Connecting to Redis..");
|
||||
});
|
||||
Database.on('error', (err) => {
|
||||
Database.on("error", (err) => {
|
||||
log.e(`Redis error: ${err.stack}`);
|
||||
});
|
||||
|
||||
export function buildKey(...args: string[]) {
|
||||
return args.join(':');
|
||||
return args.join(":");
|
||||
}
|
||||
export const KeyGroups = {
|
||||
Config: {
|
||||
Root: "config",
|
||||
Dynamic: "dynamic",
|
||||
Game: "game"
|
||||
Game: "game",
|
||||
},
|
||||
Content: {
|
||||
Root: "content",
|
||||
Images: "images",
|
||||
Rooms: "rooms",
|
||||
},
|
||||
Profile_Usernames: "profile-usernames",
|
||||
Profiles: {
|
||||
@@ -57,14 +64,16 @@ export const KeyGroups = {
|
||||
ProfileImage: "profileImage",
|
||||
Junior: "isJunior",
|
||||
Platforms: "platforms",
|
||||
DisplayName: "displayname"
|
||||
DisplayName: "displayname",
|
||||
},
|
||||
Users: {
|
||||
Root: "users",
|
||||
Profiles: "profiles",
|
||||
Pubkey: "pubkey",
|
||||
Nonces: "nonces",
|
||||
PlatformIds: "associatedPlatforms"
|
||||
}
|
||||
}
|
||||
export * as Redis from "./db.ts";
|
||||
AssociatedPlatforms: "associatedPlatforms",
|
||||
AssociatedDeviceIds: "associatedDeviceIds",
|
||||
AssociatedIps: "associatedIps",
|
||||
},
|
||||
};
|
||||
export * as Redis from "./db.ts";
|
||||
|
||||
Reference in New Issue
Block a user