Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
孙龙
/
golang-queue-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
0738d4f3
authored
Jan 14, 2020
by
孙龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
init
parent
a280fbcd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
6 deletions
order/sendPurchaseEmail/main.go
util/config.go
order/sendPurchaseEmail/main.go
View file @
0738d4f3
package
main
import
(
"flag"
"fmt"
"github.com/ichunt2019/go-msgserver/utils/rabbitmq"
"github.com/ichunt2019/logger"
...
...
@@ -45,14 +46,29 @@ func initDb(dns string) (err error) {
return
}
var
ConfigDir
string
var
LogDir
string
// 解析命令行参数
func
initArgs
()
{
// worker -config ./worker.json
// worker -h
flag
.
StringVar
(
&
ConfigDir
,
"configDir"
,
""
,
"配置文件"
)
flag
.
StringVar
(
&
LogDir
,
"logDir"
,
""
,
"日志目录"
)
flag
.
Parse
()
}
func
main
()
{
initArgs
()
//初始化配置文件
util
.
Init
()
util
.
Init
(
ConfigDir
)
//
logConfig
:=
make
(
map
[
string
]
string
)
logConfig
[
"log_path"
]
=
"logs/
order/orderSendPurchaseEmail"
logConfig
[
"log_path"
]
=
LogDir
+
"
order/orderSendPurchaseEmail"
logConfig
[
"log_chan_size"
]
=
"1000"
logger
.
InitLogger
(
"file"
,
logConfig
)
logger
.
Init
()
...
...
util/config.go
View file @
0738d4f3
...
...
@@ -42,10 +42,11 @@ type ApiDomain struct {
var
Configs
*
Config
=
new
(
Config
)
func
Init
(){
func
Init
(
ConfigDir
string
){
fmt
.
Println
(
ConfigDir
+
"config/config.toml"
)
var
err
error
_
,
err
=
toml
.
DecodeFile
(
"config/
config.toml"
,
Configs
)
_
,
err
=
toml
.
DecodeFile
(
"config/
db.toml"
,
Configs
)
_
,
err
=
toml
.
DecodeFile
(
ConfigDir
+
"
config.toml"
,
Configs
)
_
,
err
=
toml
.
DecodeFile
(
ConfigDir
+
"
db.toml"
,
Configs
)
if
err
!=
nil
{
fmt
.
Println
(
err
)
}
...
...
@@ -53,7 +54,7 @@ func Init(){
//fmt.Printf("%+v",Configs.Rabbitmq_ichunt)
//fmt.Printf("%+v",Configs.Crm_domain)
//fmt.Printf("%+v",Configs.Ding_msg)
//
//fmt.Printf("%+v",Configs.Crm_domain)
//fmt.Printf("%+v",Configs.Rabbitmq_ichunt)
}
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