Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
search_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
d5c7ccb5
authored
Jul 02, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
config多文件以及brand
parent
2e8f77e7
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
10 deletions
cmd/search_http_server.go
conf/search.ini
pkg/config/config.go
test/test.go
cmd/search_http_server.go
View file @
d5c7ccb5
...
...
@@ -12,15 +12,14 @@ import (
func
main
()
{
var
path
string
flag
.
StringVar
(
&
path
,
"config
"
,
"conf/config.ini
"
,
"配置文件"
)
flag
.
StringVar
(
&
path
,
"config
Path"
,
"conf
"
,
"配置文件"
)
flag
.
Parse
()
if
err
:=
boot
.
Boot
(
path
);
err
!=
nil
{
panic
(
err
)
}
gin
.
SetMode
(
config
.
Get
(
"web.mode"
)
.
String
())
gin
.
SetMode
(
config
.
Get
(
"web.mode"
)
.
String
())
r
:=
routes
.
InitRouter
()
port
:=
config
.
Get
(
"web.port"
)
.
String
()
//web改成micro 就是grpc,并直接注册到etcd里面
service
:=
web
.
NewService
(
...
...
conf/search.ini
View file @
d5c7ccb5
...
...
@@ -5,3 +5,8 @@
[common]
'MOUSER_API'='http://footstone.liexin.net/webapi/handle_mouser'
[brand]
is_not_ti
=
0
ti_ly_brand_ids
=
23,45069,7754,17484,43215,13421,5220,7636,44534,43556,44543,9429,758,9470,10430,10653,10707,11227,11276,11819,12608,12965,12997,13327,13675,13680,13752
ti_zy_brand_ids
=
23
\ No newline at end of file
pkg/config/config.go
View file @
d5c7ccb5
...
...
@@ -10,7 +10,8 @@ var (
)
func
SetUp
(
path
string
)
(
err
error
)
{
cfg
,
err
=
ini
.
Load
(
path
)
//引入多个文件
cfg
,
err
=
ini
.
LooseLoad
(
path
+
"/config.ini"
,
path
+
"/search.ini"
)
return
}
...
...
test/test.go
View file @
d5c7ccb5
package
main
import
(
"flag"
"fmt"
"search_server/boot"
"search_server/model"
)
func
main
()
{
//var path string
//flag.StringVar(&path, "config", "conf/config.ini", "配置文件")
//flag.Parse()
//if err := boot.Boot(path); err != nil {
// log.Error("%s", err)
//}
var
path
string
flag
.
StringVar
(
&
path
,
"configPath"
,
"conf"
,
"配置文件"
)
flag
.
Parse
()
if
err
:=
boot
.
Boot
(
path
);
err
!=
nil
{
fmt
.
Println
(
err
)
}
fmt
.
Println
(
model
.
GetExcludeBrandIds
(
1
))
//client := client.
//c := course.NewCourseService("go.micro.api.jtthink.course", client)
//course_rsp, _ := c.ListForTop(context.TODO(), &course.ListRequest{Size: 10})
...
...
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