import logger from './utils/logger'
import { join } from 'path'

let configUrl=join(__dirname, '../../config/customConfig.json')

logger.info("configUrl:"+configUrl)

let configPath=configUrl
const config = require('electron-json-config').factory(configPath)
logger.info(config)

logger.info("================config.get(MAIN_VITE_DIFY_HOST):")
logger.info(config.get('MAIN_VITE_DIFY_HOST'))
logger.info(config.get('MAIN_VITE_DIFY_HOST'))
logger.info(config.get('MAIN_VITE_DIFY_HOST'))
logger.info(config.get('MAIN_VITE_DIFY_HOST'))


 function  initFunc() {
   if(typeof config.get('MAIN_VITE_DIFY_HOST')=="undefined"){
     logger.info("set config to local json:import.meta.env.MAIN_VITE_DIFY_HOST:"+import.meta.env.MAIN_VITE_DIFY_HOST)
     config.set("MAIN_VITE_DIFY_HOST", import.meta.env.MAIN_VITE_DIFY_HOST)
   }
}




export default {
  set(key, value) {
    config.set(key, value)
  },
  get(param) {
    return config.get(param)
  }
}
