'use strict';
import { execSync } from 'child_process';
import { createError } from '../../errors/errors.js';
import { getDotenvConfig } from '../../infra/env-config.js';
import { isProdOrDemo } from '../../lib/environments.js';
import { booleanStringValues } from '../../../base-repo/constants/type-string-values.js';

var __defProp=Object['defineProperty'],__name=(_0x12d33d,_0x35442c)=>__defProp(_0x12d33d,'name',{'value':_0x35442c,'configurable':!![]});let config;const debug='Debug',configurationKeys='Configuration\x20key',localhost='http://localhost:12258';function getConfig(){return !config&&(config=loadConfig()),config;}__name(getConfig,'getConfig');function configGetString(_0xbd79da){const _0x196fe0=getConfig()[_0xbd79da];if(_0x196fe0===void(0x847+-0x1a*0x11e+0x14c5))throw createError(configurationKeys+'\x22'+_0xbd79da+'\x22\x20not\x20found');return _0x196fe0;}__name(configGetString,'configGetString');function configGetStringOrDefault(_0x5662d7,_0x4e629e){const _0x47cb67=getConfig()[_0x5662d7];if(_0x47cb67===void(-0xb1f+0xf37*0x2+-0x134f))return _0x4e629e;return _0x47cb67;}__name(configGetStringOrDefault,'configGetStringOrDefault');function configGetBool(_0x65c009){return configGetString(_0x65c009)['toLowerCase']()===booleanStringValues['true'];}__name(configGetBool,'configGetBool');function configGetInt(_0x4d7eb4){const _0x46b9e4=parseInt(configGetString(_0x4d7eb4),0x4a8+0xca9+-0x1*0x1147);if(isNaN(_0x46b9e4))throw createError(configurationKeys+'\x20\x22'+_0x4d7eb4+'\x22\x20is\x20not\x20a\x20valid\x20integer');return _0x46b9e4;}__name(configGetInt,'configGetInt');function configGetConnectionString(_0x39bace){return configGetString(_0x39bace);}__name(configGetConnectionString,'configGetConnectionString');function configSetBool(_0x5d629b,_0x21cdac){getConfig()[_0x5d629b]=_0x21cdac['toString']();}__name(configSetBool,'configSetBool');function loadConfig(){getDotenvConfig();let _0x5cbb3e;return !isProdOrDemo()&&(_0x5cbb3e=execSync('git\x20rev-parse\x20--short\x20HEAD')['toString']()['trim']()),{'JwtKey':'GeaObS0alrcif18Zym08jBzQYzzzrvnm47tRdeAhppQcCtvUgsvLmIqDtQzO3Nq','DefaultConnection':'Host=localhost;Database=Ks;User\x20ID=postgres;Password=password;Integrated\x20Security=true;Pooling=true;','LoggingIncludeScopes':booleanStringValues['false'],'LoggingDebugLogLevelDefault':debug,'LoggingConsoleLogLevelDefault':debug,'EnableHangfire':booleanStringValues['true'],'GIT_COMMIT':_0x5cbb3e??'','FRONTEND_GIT_COMMIT':_0x5cbb3e??'','AllowedCorsOrigins':localhost,'HostAddress':localhost,...process['env']};}__name(loadConfig,'loadConfig');

export { configGetBool, configGetConnectionString, configGetInt, configGetString, configGetStringOrDefault, configSetBool, getConfig };
