"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBaseCliWorkerDatabaseConfig = void 0;
const lib_1 = require("tnp-core/lib");
/**
 * Get taon service database config
 * (database is stored in user's home directory)
 * @param serviceNameUniqueInSystem - unique name of the service in the system
 * @param recreateMode - mode of database recreation, default is 'DROP_DB+MIGRATIONS'
 * @returns DatabaseConfig object with location and recreateMode
 */
const getBaseCliWorkerDatabaseConfig = (serviceNameUniqueInSystem, recreateMode = 'DROP_DB+MIGRATIONS') => {
    //#region @backendFunc
    const serviceLocation = (0, lib_1.crossPlatformPath)([
        lib_1.UtilsOs.getRealHomeDir(),
        `${lib_1.dotTaonFolder}/databases-for-services/${serviceNameUniqueInSystem}.sqlite`,
    ]);
    if (!lib_1.Helpers.exists(lib_1.path.dirname(serviceLocation))) {
        lib_1.Helpers.mkdirp(lib_1.path.dirname(serviceLocation));
    }
    // console.log('portsWorkerDatabaseLocation', portsWorkerDatabaseLocation);
    return {
        database: {
            recreateMode,
            location: serviceLocation,
        },
    };
    //#endregion
};
exports.getBaseCliWorkerDatabaseConfig = getBaseCliWorkerDatabaseConfig;
//# sourceMappingURL=base-cli-worker-database-config.js.map