Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
so-operation-api
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
smart-operation
so-operation-api
Commits
12b7d656
Commit
12b7d656
authored
Jul 04, 2023
by
陈子龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
异常列表导出 fix
parent
ee7f2b3d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
17 deletions
+15
-17
src/common/conf/options.go
src/common/conf/options.go
+1
-1
src/controller/host_manage.go
src/controller/host_manage.go
+1
-2
src/main.go
src/main.go
+12
-12
src/service/host_manage.go
src/service/host_manage.go
+1
-2
No files found.
src/common/conf/options.go
View file @
12b7d656
...
...
@@ -30,7 +30,7 @@ type Config struct {
MinioAccessKey
string
MinioSecretKey
string
MinioBucket
string
TempDirPrefix
string
//
TempDirPrefix string
PrometheusHost
string
}
...
...
src/controller/host_manage.go
View file @
12b7d656
...
...
@@ -7,7 +7,6 @@ import (
json
"github.com/json-iterator/go"
"github.com/spf13/cast"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/bean/vo/request"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/conf"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/pkg/beagle/resp"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/service"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/util"
...
...
@@ -390,7 +389,7 @@ func ExportIp(c *gin.Context) {
c
.
Writer
.
Header
()
.
Add
(
"Content-Transfer-Encoding"
,
"binary"
)
c
.
Writer
.
Header
()
.
Add
(
"Content-Disposition"
,
"filename="
+
fileName
)
c
.
File
(
conf
.
Options
.
TempDirPrefix
+
fileName
)
c
.
File
(
"/app/xlsx/"
+
fileName
)
}
// ListHostManage 列表
...
...
src/main.go
View file @
12b7d656
...
...
@@ -60,17 +60,17 @@ func initConfig() {
RedisURL
:
util
.
SetEnvStr
(
"REDIS_URL"
,
"localhost:7001"
),
RedisDB
:
0
,
RedisTag
:
"bg"
,
LogDirPrefix
:
util
.
SetEnvStr
(
"LOG_DIR_PREFIX"
,
"/app/log"
),
// 日志目录
LogDirName
:
util
.
SetEnvStr
(
"LOG_NAME"
,
"syslog"
),
// 日志名称
LogSaveDays
:
util
.
SetEnvInt
(
"LOG_SAVE_DAYS"
,
7
),
// 日志最大存储天数
LogMode
:
util
.
SetEnvInt
(
"LOG_MODE"
,
1
),
// 1.标准打印 2.输出文件
ArgBool
:
util
.
SetEnvBool
(
"ARG_BOOL"
,
false
),
// 示例参数
ArgInt
:
util
.
SetEnvInt
(
"ARG_INT"
,
10
),
// 示例参数
MinioServer
:
util
.
SetEnvStr
(
"MINIO_SERVER"
,
"https://cache.wodcloud.com"
),
// Minio 服务地址
MinioAccessKey
:
util
.
SetEnvStr
(
"MINIO_ACCESS_KEY"
,
"beagleadmin"
),
// Minio Access Key
MinioSecretKey
:
util
.
SetEnvStr
(
"MINIO_SECRET_KEY"
,
"H76cPmwvH7vJ"
),
// Minio Secret
MinioBucket
:
util
.
SetEnvStr
(
"MINIO_BUCKET"
,
"so-operation"
),
// Minio Bucket
TempDirPrefix
:
util
.
SetEnvStr
(
"TEMP_DIR_PREFIX"
,
"/app/xlsx/"
),
//模板目录前缀
LogDirPrefix
:
util
.
SetEnvStr
(
"LOG_DIR_PREFIX"
,
"/app/log"
),
// 日志目录
LogDirName
:
util
.
SetEnvStr
(
"LOG_NAME"
,
"syslog"
),
// 日志名称
LogSaveDays
:
util
.
SetEnvInt
(
"LOG_SAVE_DAYS"
,
7
),
// 日志最大存储天数
LogMode
:
util
.
SetEnvInt
(
"LOG_MODE"
,
1
),
// 1.标准打印 2.输出文件
ArgBool
:
util
.
SetEnvBool
(
"ARG_BOOL"
,
false
),
// 示例参数
ArgInt
:
util
.
SetEnvInt
(
"ARG_INT"
,
10
),
// 示例参数
MinioServer
:
util
.
SetEnvStr
(
"MINIO_SERVER"
,
"https://cache.wodcloud.com"
),
// Minio 服务地址
MinioAccessKey
:
util
.
SetEnvStr
(
"MINIO_ACCESS_KEY"
,
"beagleadmin"
),
// Minio Access Key
MinioSecretKey
:
util
.
SetEnvStr
(
"MINIO_SECRET_KEY"
,
"H76cPmwvH7vJ"
),
// Minio Secret
MinioBucket
:
util
.
SetEnvStr
(
"MINIO_BUCKET"
,
"so-operation"
),
// Minio Bucket
//
TempDirPrefix: util.SetEnvStr("TEMP_DIR_PREFIX", "/app/xlsx/"), //模板目录前缀
PrometheusHost
:
util
.
SetEnvStr
(
"PROMETHEUS_HOST"
,
"https://prometheus.wodcloud.com"
),
// Prometheus Host
}
}
...
...
@@ -132,7 +132,7 @@ func initAnsibleHosts() {
}
func
initTempDirPrefix
()
{
err
:=
os
.
Mkdir
(
conf
.
Options
.
TempDirPrefix
,
os
.
ModePerm
)
err
:=
os
.
Mkdir
(
"/app/xlsx/"
,
os
.
ModePerm
)
if
err
!=
nil
{
fmt
.
Println
(
"创建目录失败!"
)
}
...
...
src/service/host_manage.go
View file @
12b7d656
...
...
@@ -10,7 +10,6 @@ import (
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/bean/vo/request"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/bean/vo/response"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/client"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/conf"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/tools"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/pkg/beagle/resp"
"os/exec"
...
...
@@ -670,7 +669,7 @@ func generatePushExportXlsx(push []ExportIpStr) (string, error) {
}
saveFileName
:=
"IP列表导出数据.xlsx"
err
:=
file
.
Save
(
conf
.
Options
.
TempDirPrefix
+
saveFileName
)
err
:=
file
.
Save
(
"/app/xlsx/"
+
saveFileName
)
return
saveFileName
,
err
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment