summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorlinxin <[email protected]>2023-04-10 18:30:40 +0800
committerlinxin <[email protected]>2023-04-10 18:30:40 +0800
commit2c7ca6f413b8270a2ea3bb598322ee986d6877cd (patch)
tree0de341628b340f00237c53fac36f8f4fb3acead1 /config
parent14254aeb95053f98872f8962529344ee914dd3e9 (diff)
提交coredump转储功能代码
Diffstat (limited to 'config')
-rw-r--r--config/config.go38
1 files changed, 38 insertions, 0 deletions
diff --git a/config/config.go b/config/config.go
new file mode 100644
index 0000000..b8fcc3c
--- /dev/null
+++ b/config/config.go
@@ -0,0 +1,38 @@
+package config
+
+import (
+ "encoding/json"
+ "io/ioutil"
+)
+
+type Coreconfig struct {
+ Core_pattern string
+ Core_limited string
+ Core__pipe_limit string
+ Socket_path string
+}
+type Pipeconfig struct {
+ Save_model int //0为文件保存 1为压缩保存 2为minidump保存
+ File_base_path string
+ Total_file_mem_limit string
+ Containered_sock_path string
+}
+
+func Init() (Coreconfig, error) {
+ var config Coreconfig
+ content, err := ioutil.ReadFile("./config.json")
+ if err != nil {
+ return config, err
+ }
+ err = json.Unmarshal(content, &config)
+ return config, err
+}
+func PipeInit() (Pipeconfig, error) {
+ var config Pipeconfig
+ content, err := ioutil.ReadFile("./pipe-config.json")
+ if err != nil {
+ return config, err
+ }
+ err = json.Unmarshal(content, &config)
+ return config, err
+}