feat: config refactoring #219
@ -1,5 +1,5 @@
|
|||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import config from "@/config.json";
|
import { config } from "@/src/services/configService";
|
||||||
import { getInventory } from "@/src/services/inventoryService";
|
import { getInventory } from "@/src/services/inventoryService";
|
||||||
import { parseString } from "@/src/helpers/general";
|
import { parseString } from "@/src/helpers/general";
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import config from "@/config.json";
|
import { config } from "@/src/services/configService";
|
||||||
import allShipFeatures from "@/static/fixed_responses/allShipFeatures.json";
|
import allShipFeatures from "@/static/fixed_responses/allShipFeatures.json";
|
||||||
import { parseString } from "@/src/helpers/general";
|
import { parseString } from "@/src/helpers/general";
|
||||||
import { getPersonalRooms } from "@/src/services/personalRoomsService";
|
import { getPersonalRooms } from "@/src/services/personalRoomsService";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
import { toInventoryResponse } from "@/src/helpers/inventoryHelpers";
|
import { toInventoryResponse } from "@/src/helpers/inventoryHelpers";
|
||||||
import { Inventory } from "@/src/models/inventoryModels/inventoryModel";
|
import { Inventory } from "@/src/models/inventoryModels/inventoryModel";
|
||||||
import { Request, RequestHandler, Response } from "express";
|
import { Request, RequestHandler, Response } from "express";
|
||||||
import config from "@/config.json";
|
import { config } from "@/src/services/configService";
|
||||||
import allMissions from "@/static/fixed_responses/allMissions.json";
|
import allMissions from "@/static/fixed_responses/allMissions.json";
|
||||||
import allQuestKeys from "@/static/fixed_responses/allQuestKeys.json";
|
import allQuestKeys from "@/static/fixed_responses/allQuestKeys.json";
|
||||||
import allShipDecorations from "@/static/fixed_responses/allShipDecorations.json";
|
import allShipDecorations from "@/static/fixed_responses/allShipDecorations.json";
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
|
|
||||||
import config from "@/config.json";
|
import { config } from "@/src/services/configService";
|
||||||
import buildConfig from "@/static/data/buildConfig.json";
|
import buildConfig from "@/static/data/buildConfig.json";
|
||||||
|
|
||||||
import { toLoginRequest } from "@/src/helpers/loginHelpers";
|
import { toLoginRequest } from "@/src/helpers/loginHelpers";
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { RequestHandler } from "express";
|
import { RequestHandler } from "express";
|
||||||
import { Inventory } from "@/src/models/inventoryModels/inventoryModel";
|
import { Inventory } from "@/src/models/inventoryModels/inventoryModel";
|
||||||
import { IStatsView } from "@/src/types/statTypes";
|
import { IStatsView } from "@/src/types/statTypes";
|
||||||
import config from "@/config.json";
|
import { config } from "@/src/services/configService";
|
||||||
import view from "@/static/fixed_responses/view.json";
|
import view from "@/static/fixed_responses/view.json";
|
||||||
import allScans from "@/static/fixed_responses/allScans.json";
|
import allScans from "@/static/fixed_responses/allScans.json";
|
||||||
|
|
||||||
|
24
src/services/configService.ts
Normal file
24
src/services/configService.ts
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import rawConfig from "@/config.json";
|
||||||
|
|
||||||
|
interface IConfig {
|
||||||
|
mongodbUrl: string;
|
||||||
|
logger: ILoggerConfig;
|
||||||
|
myAddress: string;
|
||||||
|
autoCreateAccount?: boolean;
|
||||||
|
skipStoryModeChoice?: boolean;
|
||||||
|
skipTutorial?: boolean;
|
||||||
|
unlockAllScans?: boolean;
|
||||||
|
unlockAllMissions?: boolean;
|
||||||
|
unlockAllQuests?: boolean;
|
||||||
|
infiniteResources?: boolean;
|
||||||
|
unlockallShipFeatures?: boolean;
|
||||||
|
unlockAllShipDecorations?: boolean;
|
||||||
|
unlockAllFlavourItems?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ILoggerConfig {
|
||||||
|
files: boolean;
|
||||||
|
level: string; // "fatal" | "error" | "warn" | "info" | "http" | "debug" | "trace";
|
||||||
|
}
|
||||||
|
|
||||||
|
export const config: IConfig = rawConfig;
|
@ -1,6 +1,6 @@
|
|||||||
import { Inventory } from "@/src/models/inventoryModels/inventoryModel";
|
import { Inventory } from "@/src/models/inventoryModels/inventoryModel";
|
||||||
import new_inventory from "@/static/fixed_responses/postTutorialInventory.json";
|
import new_inventory from "@/static/fixed_responses/postTutorialInventory.json";
|
||||||
import config from "@/config.json";
|
import { config } from "@/src/services/configService";
|
||||||
import { Types } from "mongoose";
|
import { Types } from "mongoose";
|
||||||
import { ISuitClient } from "@/src/types/inventoryTypes/SuitTypes";
|
import { ISuitClient } from "@/src/types/inventoryTypes/SuitTypes";
|
||||||
import { SlotNames } from "@/src/types/purchaseTypes";
|
import { SlotNames } from "@/src/types/purchaseTypes";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { logger } from "@/src/utils/logger";
|
import { logger } from "@/src/utils/logger";
|
||||||
import config from "@/config.json";
|
import { config } from "@/src/services/configService";
|
||||||
import mongoose from "mongoose";
|
import mongoose from "mongoose";
|
||||||
|
|
||||||
const url = config.mongodbUrl;
|
const url = config.mongodbUrl;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { createLogger, format, transports, Logger, LeveledLogMethod, addColors } from "winston";
|
import { createLogger, format, transports, Logger, LeveledLogMethod, addColors } from "winston";
|
||||||
import "winston-daily-rotate-file";
|
import "winston-daily-rotate-file";
|
||||||
import config from "@/config.json";
|
import { config } from "@/src/services/configService";
|
||||||
import * as util from "util";
|
import * as util from "util";
|
||||||
import { isEmptyObject } from "@/src/helpers/general";
|
import { isEmptyObject } from "@/src/helpers/general";
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user