"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "AppDataSource", {
    enumerable: true,
    get: function() {
        return AppDataSource;
    }
});
require("reflect-metadata");
const _typeorm = require("typeorm");
const _dotenv = /*#__PURE__*/ _interop_require_default(require("dotenv"));
const _path = require("path");
const _serverconstants = require("./server.constants");
const _fsutils = require("./utils/fs.utils");
const _floorentity = require("./entities/floor.entity");
const _floorpositionentity = require("./entities/floor-position.entity");
const _printerentity = require("./entities/printer.entity");
const _settingsentity = require("./entities/settings.entity");
const _entities = require("./entities");
const _camerastreamentity = require("./entities/camera-stream.entity");
const _customgcodeentity = require("./entities/custom-gcode.entity");
const _roleentity = require("./entities/role.entity");
const _userroleentity = require("./entities/user-role.entity");
const _1706829146617InitSqlite = require("./migrations/1706829146617-InitSqlite");
const _printergroupentity = require("./entities/printer-group.entity");
const _groupentity = require("./entities/group.entity");
const _1707494762198PrinterGroup = require("./migrations/1707494762198-PrinterGroup");
const _1708465930665ChangePrintCompletionDeletePrinterCascade = require("./migrations/1708465930665-ChangePrintCompletionDeletePrinterCascade");
const _1713300747465ChangeRoleNameUnique = require("./migrations/1713300747465-ChangeRoleNameUnique");
const _1720338804844RemovePrinterFile = require("./migrations/1720338804844-RemovePrinterFile");
const _1713897879622AddPrinterType = require("./migrations/1713897879622-AddPrinterType");
function _interop_require_default(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    };
}
_dotenv.default.config({
    path: (0, _path.join)((0, _fsutils.superRootPath)(), ".env")
});
const dbFolder = process.env[_serverconstants.AppConstants.DATABASE_PATH] || "./database";
const dbFile = process.env[_serverconstants.AppConstants.DATABASE_FILE] || "./fdm-monster.sqlite";
const dbName = dbFile === ":memory:" ? dbFile : (0, _path.join)((0, _fsutils.superRootPath)(), dbFolder, dbFile);
const AppDataSource = new _typeorm.DataSource({
    type: "better-sqlite3",
    database: dbName,
    synchronize: false,
    logging: false,
    entities: [
        _floorentity.Floor,
        _floorpositionentity.FloorPosition,
        _printerentity.Printer,
        _settingsentity.Settings,
        _entities.User,
        _camerastreamentity.CameraStream,
        _customgcodeentity.CustomGcode,
        _roleentity.Role,
        _entities.Permission,
        _entities.RefreshToken,
        _entities.PrintCompletion,
        _userroleentity.UserRole,
        _groupentity.Group,
        _printergroupentity.PrinterGroup
    ],
    migrations: [
        _1706829146617InitSqlite.InitSqlite1706829146617,
        _1707494762198PrinterGroup.PrinterGroup1707494762198,
        _1708465930665ChangePrintCompletionDeletePrinterCascade.ChangePrintCompletionDeletePrinterCascade1708465930665,
        _1713300747465ChangeRoleNameUnique.ChangeRoleNameUnique1713300747465,
        _1720338804844RemovePrinterFile.RemovePrinterFile1720338804844,
        _1713897879622AddPrinterType.AddPrinterType1713897879622
    ],
    subscribers: []
});

//# sourceMappingURL=data-source.js.map