import { mkdirSync, readFileSync } from "fs";
import logger from "src/system/Logger";

class Configure {
  db: {
    auth: string;
    db: string;
    remote: string;
    avatar: string;
  };
  path: {
    essay: string;
    avatar: string;
  };
  www: {
    qwilight: string;
  };
  postLength: number;

  constructor() {
    const { db, path, www, postLength } = JSON.parse(
      readFileSync("Configure.json", "utf-8"),
    );

    this.db = db;
    this.path = path;
    this.www = www;
    this.postLength = postLength;

    mkdirSync(this.path.essay, { recursive: true });
    mkdirSync(this.path.avatar, { recursive: true });

    logger.info("Loaded Configure");
  }
}

export default new Configure();
