config.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  1. package utils
  2. import (
  3. "errors"
  4. "fmt"
  5. "strconv"
  6. beeLogger "github.com/beego/bee/v2/logger"
  7. "github.com/beego/beego/v2/server/web"
  8. "github.com/qiniu/qmgo"
  9. "github.com/spf13/viper"
  10. )
  11. // 大模型配置
  12. var (
  13. DS_LLM_SERVER string //模型服务地址
  14. )
  15. var (
  16. RunMode string //运行模式
  17. MYSQL_URL string //数据库连接
  18. MYSQL_URL_RDDP string //数据库连接
  19. MYSQL_URL_EDB string
  20. MYSQL_URL_DATA string
  21. MYSQL_URL_GL string
  22. MYSQL_LOG_URL string
  23. MYSQL_WEEKLY_URL string //用户主库
  24. MYSQL_AI_URL string //ETA-AI 数据库
  25. MgoUrlData string // mongodb数据库连接配置
  26. DbDriverName string // 数据库驱动名称
  27. REDIS_CACHE string //缓存地址
  28. //Rc *cache.Cache //redis缓存
  29. Re error //redis错误
  30. Rc RedisClient //redis缓存
  31. MgoDataCli *qmgo.Client // mongodb客户端连接
  32. MgoDataDbName string // mongodb指标数据的库名
  33. )
  34. // binlog
  35. var (
  36. MYSQL_DATA_BINLOG_URL string // 数据指标库binlog地址
  37. MYSQL_DATA_BINLOG_USER string // 数据指标库binlog用户名
  38. MYSQL_DATA_BINLOG_PWD string // 数据指标库binlog密码
  39. MYSQL_DATA_BINLOG_DB string // 数据指标库binlog位置
  40. MYSQL_DATA_BINLOG_SERVER_ID string // 数据指标库binlog server_id
  41. MYSQL_DATA_BINLOG_DB_EDB string // 数据手工指标binlog位置
  42. MYSQL_DATA_BINLOG_DB_GL string // 数据钢联binlog位置
  43. )
  44. // 基础配置
  45. var (
  46. STATIC_DIR string
  47. DesKey string // 接口返回加密KEY
  48. APPNAME string //项目中文名称
  49. EmailSendToUsers string // 邮件提醒人员
  50. JhGnAppKey string // 聚合短信,国内AppKey
  51. JhGjAppKey string // 聚合短信,国际AppKey
  52. ResourceProxyUrl string // 代理资源地址
  53. RESOURCE_DIR string
  54. )
  55. // ES配置
  56. var (
  57. ES_URL string // ES服务器地址
  58. ES_USERNAME string // ES账号
  59. ES_PASSWORD string // ES密码
  60. )
  61. // 公共api内部服务调用
  62. var (
  63. // EDB_LIB_URL 公共指标库
  64. EDB_LIB_URL string
  65. APP_EDB_LIB_NAME_EN string
  66. EDB_LIB_Md5_KEY string
  67. // PublicChartHost 公共图库的host
  68. PublicChartHost string
  69. // MySteelPostUrl 钢联化工的服务地址
  70. MySteelPostUrl string
  71. // SendWxTemplateMsgUrl 模板消息推送
  72. SendWxTemplateMsgUrl string
  73. // SendTemplateMsgAuthorization 模板推送秘钥
  74. SendTemplateMsgAuthorization string
  75. // HandleVideoDecibelUrl 处理音频分贝的url
  76. HandleVideoDecibelUrl string
  77. // Ppt2ImageUrl ppt转图片服务的地址
  78. Ppt2ImageUrl string
  79. // HongzeOpenApiHost 开放openapi的地址
  80. HongzeOpenApiHost string
  81. // EnglishShareUrl 英文研报群发邮件分享地址
  82. EnglishShareUrl string
  83. // EnPolicyReportUrl 英文策略报告
  84. EnPolicyReportUrl string
  85. // GoogleTranslateUrl 谷歌翻译服务
  86. GoogleTranslateUrl string
  87. // AlarmMsgUrl 报警服务地址
  88. AlarmMsgUrl string
  89. // ChatUrl chatGPT服务地址
  90. ChatUrl string
  91. EtaBridgeUrl string // 桥接服务地址
  92. EtaBridgeAppNameEn string // 桥接服务英文名称-鉴权用
  93. EtaBridgeMd5Key string // 桥接服务Md5密钥-鉴权用
  94. EtaBridgeDesKey string // 桥接服务Des密钥-解密数据用
  95. EtaBridgeLoginUrl string // 第三方登录鉴权接口地址
  96. EtaBridgeLogoutUrl string // 第三方登出接口地址
  97. ETAMiniBridgeUrl string // 桥接服务地址
  98. ETA_MINI_APPID string // 桥接服务-鉴权用
  99. ETA_MINI_APP_SECRET string // 桥接服务-鉴权用
  100. )
  101. // 微信配置信息
  102. var (
  103. WxId string //微信原始ID
  104. WxAppId string // 公众号appid
  105. WxAppSecret string // 公众号秘钥
  106. TemplateIdByProduct string //产品运行报告通知-模板ID
  107. WxYbAppId string // 研报小程序appid
  108. WxYbId string // 研报小程序微信原始ID
  109. WxYbAppSecret string // 研报小程序秘钥
  110. WxYbPlatform int //弘则研报来源
  111. )
  112. // ES索引配置
  113. var (
  114. DATA_INDEX_NAME string //数据指标库索引
  115. CHART_INDEX_NAME string //研究图库索引
  116. EsReportIndexName string //研报ES索引
  117. EsEnglishReportIndexName string //英文研报ES索引
  118. MY_CHART_INDEX_NAME string //研究图库(MY ETA)索引
  119. EsSemanticAnalysisDocIndexName string //ES语义分析文档索引名
  120. SmartReportIndexName string //智能研报ES索引
  121. EsExcelIndexName string // 表格ES索引名称
  122. EsDataSourceIndexName string // 数据源ES索引名称
  123. )
  124. var (
  125. XfHostUrl string // 科大讯飞--语音合成
  126. )
  127. // 对象存储客户端
  128. var (
  129. ObjectStorageClient string // 目前有oss minio,默认oss
  130. PptUpdateApi string //ppt 通过后端接口的方式上传
  131. )
  132. // 阿里云配置
  133. var (
  134. Bucketname string
  135. Endpoint string
  136. Imghost string
  137. UploadDir string
  138. Upload_Audio_Dir string
  139. AccessKeyId string
  140. AccessKeySecret string
  141. )
  142. // 阿里云oss前端上传用
  143. var (
  144. AliStsScheme string
  145. RegionId string
  146. RoleArn string
  147. RoleSessionName string
  148. RAMAccessKeyId string
  149. RAMAccessKeySecret string
  150. STSTokenCacheKey string
  151. )
  152. // 阿里云邮箱配置
  153. var (
  154. AliyunEmailAccountName string
  155. AliyunEmailAccessKeyId string
  156. AliyunEmailAccessKeySecret string
  157. AliyunEmailReplyAddress string
  158. AliyunEmailReplyAddressAlias string
  159. )
  160. // 腾讯云邮箱配置
  161. var (
  162. TencentSDKSecretId string // 腾讯云主账号SecretId
  163. TencentSDKSecretKey string // 腾讯云主账号SecretKey
  164. TencentEmailFromEmailAddress string // 腾讯云邮件发信地址
  165. TencentEmailTemplateID uint64 // 云邮件模板ID
  166. )
  167. // LibreOfficePath LibreOfficePath的地址
  168. var LibreOfficePath string
  169. // CrmEtaServerUrl CRM-ETA服务地址
  170. var (
  171. CrmEtaServerUrl string
  172. CrmEtaServerDes3Key string
  173. )
  174. // eta_forum_hub ETA社区桥接服务地址
  175. var (
  176. ETA_FORUM_HUB_URL string
  177. ETA_FORUM_HUB_NAME_EN string
  178. ETA_FORUM_HUB_MD5_KEY string
  179. )
  180. // BusinessCode 商家编码
  181. var BusinessCode string
  182. // 日志配置
  183. var (
  184. LogPath string //调用过程中的日志存放地址
  185. LogFile string
  186. LogDataPath string //调用过程中图表相关的日志存放地址
  187. LogDataFile string
  188. BinLogPath string //数据库相关的日志存放地址
  189. BinLogFile string
  190. ApiLogPath string //接口请求地址和接口返回值日志存放地址
  191. ApiLogFile string
  192. LogMaxDays int //日志最大保留天数
  193. )
  194. // MinIo配置
  195. var (
  196. MinIoBucketname string
  197. MinIoEndpoint string
  198. MinIoBackEndpoint string
  199. MinIoImghost string
  200. MinIoUploadDir string
  201. MinIoUpload_Audio_Dir string
  202. MinIoAccessKeyId string
  203. MinIoAccessKeySecret string
  204. MinIoUseSSL string
  205. MinIoPort string
  206. MinIoRegion string
  207. MinIoFileDownloadHost string
  208. )
  209. // PythonUrlReport2Img 生成长图服务地址
  210. var PythonUrlReport2Img string
  211. // ETA-AI服务
  212. var EtaAiUrl string
  213. var (
  214. EtaAppid string
  215. EtaSecret string
  216. )
  217. // S3配置
  218. var (
  219. S3Endpoint string
  220. S3BackEndpoint string
  221. S3BucketName string
  222. S3UploadDir string
  223. S3AccessKeyId string
  224. S3AccessKeySecret string
  225. S3Host string
  226. S3Region string
  227. S3ForceStyle string
  228. S3EndpointPort string
  229. S3Protocol string
  230. S3DisableSSL string
  231. S3OpenAcl string
  232. )
  233. // chrome配置
  234. var (
  235. ChromePath string // chrome浏览器地址
  236. )
  237. var (
  238. ErrMsgConfigFile string
  239. )
  240. var (
  241. ViperConfig *viper.Viper
  242. )
  243. var (
  244. UseMongo bool // 是否使用mongo
  245. )
  246. var (
  247. CommandPython string // python命令
  248. )
  249. func init() {
  250. tmpRunMode, err := web.AppConfig.String("run_mode")
  251. if err != nil {
  252. panic(any("配置文件读取run_mode错误 " + err.Error()))
  253. }
  254. RunMode = tmpRunMode
  255. fmt.Println("RunMode:", RunMode)
  256. if RunMode == "" {
  257. localIp, err := GetLocalIP()
  258. fmt.Println("localIp:", localIp)
  259. if localIp == "10.0.0.123" {
  260. RunMode = "debug"
  261. } else {
  262. RunMode = "release"
  263. }
  264. fmt.Println("RunMode:", RunMode)
  265. configPath := `/home/code/config/eta_api/conf/app.conf`
  266. fmt.Println("configPath:", configPath)
  267. err = web.LoadAppConfig("ini", configPath)
  268. if err != nil {
  269. fmt.Println("web.LoadAppConfig Err:" + err.Error())
  270. }
  271. }
  272. config, err := web.AppConfig.GetSection(RunMode)
  273. if err != nil {
  274. panic(any("配置文件读取错误 " + err.Error()))
  275. }
  276. beeLogger.Log.Info(RunMode + " 模式")
  277. MYSQL_URL = config["mysql_url"]
  278. MYSQL_URL_RDDP = config["mysql_url_rddp"]
  279. MYSQL_URL_EDB = config["mysql_url_edb"]
  280. MYSQL_URL_DATA = config["mysql_url_data"]
  281. MYSQL_URL_GL = config["mysql_url_gl"]
  282. MYSQL_LOG_URL = config["mysql_url_log"]
  283. // 用户主库
  284. MYSQL_WEEKLY_URL = config["mysql_url_weekly"]
  285. // 用户主库
  286. MYSQL_WEEKLY_URL = config["mysql_url_weekly"]
  287. //ETA-AI
  288. MYSQL_AI_URL = config["mysql_url_ai"]
  289. // 数据库驱动名称
  290. DbDriverName = config["db_driver_name"]
  291. if DbDriverName == "" {
  292. DbDriverName = "mysql"
  293. }
  294. // binlog配置
  295. {
  296. MYSQL_DATA_BINLOG_URL = config["mysql_data_binlog_url"]
  297. MYSQL_DATA_BINLOG_USER = config["mysql_data_binlog_user"]
  298. MYSQL_DATA_BINLOG_PWD = config["mysql_data_binlog_pwd"]
  299. MYSQL_DATA_BINLOG_DB = config["mysql_data_binlog_db"]
  300. MYSQL_DATA_BINLOG_SERVER_ID = config["mysql_data_binlog_server_id"]
  301. MYSQL_DATA_BINLOG_DB_EDB = config["mysql_data_binlog_db_edb"]
  302. MYSQL_DATA_BINLOG_DB_GL = config["mysql_data_binlog_db_gl"]
  303. }
  304. // mongodb数据库连接配置
  305. MgoUrlData = config["mgo_url_data"]
  306. REDIS_CACHE = config["beego_cache"]
  307. if len(REDIS_CACHE) <= 0 {
  308. panic(any("redis链接参数没有配置"))
  309. }
  310. //Rc, Re = cache.NewCache(REDIS_CACHE) //初始化缓存
  311. //if Re != nil {
  312. // fmt.Println("redis链接异常:", Re)
  313. // panic(any(Re))
  314. //}
  315. // 初始化缓存
  316. redisClient, err := initRedis(config["redis_type"], config["beego_cache"])
  317. if err != nil {
  318. fmt.Println("redis链接异常:", err)
  319. panic(any(Re))
  320. }
  321. Rc = redisClient
  322. // 项目中文名称
  323. appNameCn, err := web.AppConfig.String("app_name_cn")
  324. if err != nil {
  325. panic(any("配置文件读取app_name_cn错误 " + err.Error()))
  326. }
  327. APPNAME = appNameCn
  328. // 初始化内部服务配置
  329. // 接口返回加密KEY
  330. DesKey = config["des_key"]
  331. // 邮件提醒人员
  332. EmailSendToUsers = config["email_send_to_users"]
  333. // 聚合短信,国内AppKey
  334. JhGnAppKey = config["jh_gn_app_key"]
  335. JhGjAppKey = config["jh_gj_app_key"]
  336. // ppt 转图片服务地址
  337. Ppt2ImageUrl = config["ppt2_image_url"]
  338. // 静态文件目录
  339. STATIC_DIR = config["static_dir"]
  340. // 代理资源地址
  341. ResourceProxyUrl = config["resource_proxy_url"]
  342. RESOURCE_DIR = config["resource_dir"]
  343. if RESOURCE_DIR == "" {
  344. RESOURCE_DIR = "eta/"
  345. }
  346. // 系统内部服务地址
  347. {
  348. // 公共指标库相关
  349. EDB_LIB_URL = config["edb_lib_url"]
  350. APP_EDB_LIB_NAME_EN = config["app_edb_lib_name_en"]
  351. EDB_LIB_Md5_KEY = config["edb_lib_md5_key"]
  352. // 图表项目域名
  353. PublicChartHost = config["public_chart_host"]
  354. // 钢联化工服务地址
  355. MySteelPostUrl = config["mysteel_post_url"]
  356. // 发送微信模板消息地址
  357. SendWxTemplateMsgUrl = config["send_wx_template_msg_url"]
  358. // 发送微信模板消息地址
  359. SendTemplateMsgAuthorization = config["send_template_msg_authorization"]
  360. // 语音分贝处理的地址
  361. HandleVideoDecibelUrl = config["handle_video_decibel_url"]
  362. // 弘则open api的地址
  363. HongzeOpenApiHost = config["hongze_open_api_host"]
  364. // 英文研报分享的地址
  365. EnglishShareUrl = config["english_share_url"]
  366. // 策略报告地址
  367. EnPolicyReportUrl = config["en_policy_report_url"]
  368. // 谷歌翻译服务地址
  369. GoogleTranslateUrl = config["google_translate_url"]
  370. // 报警服务地址
  371. AlarmMsgUrl = config["alarm_msg_url"]
  372. // chatGPT服务地址
  373. ChatUrl = config["chat_url"]
  374. EtaBridgeUrl = config["eta_bridge_url"] // 桥接服务地址
  375. EtaBridgeAppNameEn = config["eta_bridge_app_name_en"] // 桥接服务英文名称-鉴权用
  376. EtaBridgeMd5Key = config["eta_bridge_md5_key"] // 桥接服务Md5密钥-鉴权用
  377. EtaBridgeDesKey = config["eta_bridge_des_key"] // 桥接服务Des密钥-解密数据用
  378. EtaBridgeLoginUrl = config["eta_bridge_login_url"] // eta桥接服务-登录接口地址
  379. EtaBridgeLogoutUrl = config["eta_bridge_logout_url"] // eta桥接服务-登出接口地址
  380. }
  381. //日志配置
  382. {
  383. LogPath = config["log_path"]
  384. LogFile = config["log_file"]
  385. LogDataPath = config["log_data_path"]
  386. LogDataFile = config["log_data_file"]
  387. BinLogPath = config["binlog_path"]
  388. BinLogFile = config["binlog_file"]
  389. ApiLogPath = config["apilog_path"]
  390. ApiLogFile = config["apilog_file"]
  391. logMaxDaysStr := config["log_max_day"]
  392. LogMaxDays, _ = strconv.Atoi(logMaxDaysStr)
  393. }
  394. // ES配置
  395. {
  396. ES_URL = config["es_url"]
  397. ES_USERNAME = config["es_username"]
  398. ES_PASSWORD = config["es_password"]
  399. }
  400. // 微信相关
  401. {
  402. WxAppId = config["wx_appid"]
  403. WxAppSecret = config["wx_app_secret"]
  404. WxId = config["wx_id"]
  405. //模板消息
  406. TemplateIdByProduct = config["template_id_by_product"]
  407. WxYbAppId = config["wx_yb_appid"] //弘则研报小程序
  408. WxYbId = config["wx_yb_id"] // 研报小程序微信原始ID
  409. WxYbAppSecret = config["wx_yb_app_secret"] // 研报小程序秘钥
  410. wxYbPlatformStr := config["wx_yb_platform"]
  411. if wxYbPlatformStr != `` {
  412. WxYbPlatform, err = strconv.Atoi(wxYbPlatformStr) //弘则研报来源
  413. if err != nil {
  414. panic(any("配置文件读取wx_yb_platform错误 " + err.Error()))
  415. }
  416. }
  417. }
  418. // 对象存储客户端
  419. ObjectStorageClient = config["object_storage_client"]
  420. // ppt上传是否走后端
  421. PptUpdateApi = config["ppt_update_api"]
  422. // OSS相关
  423. {
  424. Endpoint = config["endpoint"]
  425. Bucketname = config["bucket_name"]
  426. Imghost = config["img_host"]
  427. UploadDir = config["upload_dir"]
  428. Upload_Audio_Dir = config["upload_audio_dir"]
  429. AccessKeyId = config["access_key_id"]
  430. AccessKeySecret = config["access_key_secret"]
  431. }
  432. // OSS相关(前端使用)
  433. {
  434. AliStsScheme = config["ali_sts_scheme"]
  435. RegionId = config["region_id"]
  436. RoleArn = config["role_arn"]
  437. RoleSessionName = config["role_session_name"]
  438. RAMAccessKeyId = config["ram_access_key_id"]
  439. RAMAccessKeySecret = config["ram_access_key_secret"]
  440. STSTokenCacheKey = config["sts_token_cache_key"]
  441. }
  442. // 阿里云邮箱配置
  443. {
  444. AliyunEmailAccountName = config["aliyun_email_account_name"]
  445. AliyunEmailAccessKeyId = config["aliyun_email_access_key_id"]
  446. AliyunEmailAccessKeySecret = config["aliyun_email_access_key_secret"]
  447. AliyunEmailReplyAddress = config["aliyun_email_reply_address"]
  448. AliyunEmailReplyAddressAlias = config["aliyun_email_reply_address_alias"]
  449. }
  450. // 腾讯云邮箱配置
  451. {
  452. TencentSDKSecretId = config["tencent_sdk_secret_id"] // 腾讯云主账号SecretId
  453. TencentSDKSecretKey = config["tencent_sdk_secret_key"] // 腾讯云主账号SecretKey
  454. TencentEmailFromEmailAddress = config["tencent_email_from_email_address"] // 腾讯云邮件发信地址
  455. tencentEmailTemplateIDtr := config["tencent_email_template_id"]
  456. if tencentEmailTemplateIDtr != `` {
  457. tmpTencentEmailTemplateID, err := strconv.Atoi(tencentEmailTemplateIDtr) //弘则研报来源
  458. if err != nil {
  459. panic(any("配置文件读取tencent_email_template_id错误 " + err.Error()))
  460. }
  461. TencentEmailTemplateID = uint64(tmpTencentEmailTemplateID)
  462. }
  463. }
  464. // 科大讯飞
  465. {
  466. //XfAPPID = config["xf_appid"]
  467. //XfAPIKey = config["xf_api_key"]
  468. //XfAPISecret = config["xf_api_secret"]
  469. XfHostUrl = config["xf_host_url"]
  470. //XfOrigin = config["xf_origin"]
  471. //XfVcn = config["xf_vcn"]
  472. }
  473. // ES 索引
  474. {
  475. DATA_INDEX_NAME = config["data_index_name"]
  476. CHART_INDEX_NAME = config["chart_index_name"]
  477. MY_CHART_INDEX_NAME = config["my_chart_index_name"]
  478. EsReportIndexName = config["es_report_index_name"]
  479. EsEnglishReportIndexName = config["es_english_report_index_name"]
  480. EsSemanticAnalysisDocIndexName = config["es_semantic_analysis_doc_index_name"]
  481. SmartReportIndexName = config["es_smart_report_index_name"]
  482. }
  483. CrmEtaServerUrl = config["crm_eta_server_url"]
  484. CrmEtaServerDes3Key = config["crm_eta_server_des3_key"]
  485. LibreOfficePath = config["libre_office_path"]
  486. // eta_forum_hub ETA社区桥接服务地址
  487. {
  488. ETA_FORUM_HUB_URL = config["eta_forum_hub_url"]
  489. ETA_FORUM_HUB_NAME_EN = config["eta_forum_hub_name_en"]
  490. ETA_FORUM_HUB_MD5_KEY = config["eta_forum_hub_md5_key"]
  491. }
  492. // 商家编码
  493. BusinessCode = config["business_code"]
  494. // eta_mini_bridge 小程序桥接服务地址
  495. {
  496. ETAMiniBridgeUrl = config["eta_mini_bridge_url"]
  497. ETA_MINI_APPID = config["eta_mini_bridge_appid"] // 桥接服务-鉴权用
  498. ETA_MINI_APP_SECRET = config["eta_mini_bridge_secret"] // 桥接服务-鉴权用
  499. }
  500. // MinIo相关
  501. {
  502. MinIoEndpoint = config["minio_endpoint"]
  503. MinIoBackEndpoint = config["minio_back_endpoint"]
  504. MinIoBucketname = config["minio_bucket_name"]
  505. MinIoImghost = config["minio_img_host"]
  506. MinIoUploadDir = config["minio_upload_dir"]
  507. MinIoUpload_Audio_Dir = config["minio_upload_audio_dir"]
  508. MinIoAccessKeyId = config["minio_access_key_id"]
  509. MinIoAccessKeySecret = config["minio_access_key_secret"]
  510. MinIoUseSSL = config["minio_use_ssl"]
  511. MinIoPort = config["minio_port"]
  512. MinIoRegion = config["minio_region"]
  513. MinIoFileDownloadHost = config["minio_file_download_host"]
  514. }
  515. // S3-OSS相关
  516. {
  517. S3Endpoint = config["s3_endpoint"]
  518. S3BackEndpoint = config["s3_back_endpoint"]
  519. S3BucketName = config["s3_bucket_name"]
  520. S3Host = config["s3_host"]
  521. S3AccessKeyId = config["s3_access_key_id"]
  522. S3AccessKeySecret = config["s3_access_key_secret"]
  523. S3UploadDir = config["s3_upload_dir"]
  524. S3Region = config["s3_region"]
  525. S3ForceStyle = config["s3_force_style"]
  526. S3EndpointPort = config["s3_endpoint_port"]
  527. S3Protocol = config["s3_protocol"]
  528. S3DisableSSL = config["s3_disable_ssl"]
  529. S3OpenAcl = config["s3_open_acl"]
  530. }
  531. // 生成长图服务地址
  532. PythonUrlReport2Img = config["python_url_report2img"]
  533. EtaAiUrl = config["eta_ai_url"]
  534. EtaAppid = config["eta_appid"]
  535. EtaSecret = config["eta_secret"]
  536. // chrome配置
  537. ChromePath = config["chrome_path"]
  538. //模型服务器地址
  539. DS_LLM_SERVER = config["llm_server"]
  540. // 初始化ES
  541. initEs()
  542. ErrMsgConfigFile = config["err_msg_config_file"]
  543. if ErrMsgConfigFile != "" {
  544. viper.SetConfigFile(ErrMsgConfigFile)
  545. err = viper.ReadInConfig()
  546. if err != nil {
  547. if _, ok := err.(viper.ConfigFileNotFoundError); ok {
  548. fmt.Println(errors.New("config file not found"))
  549. panic(any("config file not found"))
  550. } else {
  551. fmt.Println(errors.New("config file was found but another error was produced err:" + err.Error()))
  552. panic(any("config file was found but another error was produced err:" + err.Error()))
  553. }
  554. return
  555. }
  556. ViperConfig = viper.GetViper()
  557. }
  558. CommandPython = config["command_python"]
  559. if CommandPython == "" {
  560. CommandPython = "python3"
  561. }
  562. fmt.Println(CommandPython)
  563. }