update
1. add makefile 2. modify dockerfile 3. add config twitch.bot_user
This commit is contained in:
parent
116c43b0cb
commit
8a4b11f92a
@ -1,7 +1,9 @@
|
|||||||
FROM golang:1.11-alpine3.8 as builder
|
FROM golang:1.11-alpine3.8 as builder
|
||||||
WORKDIR /go/src/git.trj.tw/golang/mtfosbot
|
WORKDIR /go/src/git.trj.tw/golang/mtfosbot
|
||||||
|
RUN apk add --no-cache make git
|
||||||
|
RUN go get -u github.com/otakukaze/go-bindata/...
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN GOOS=linux go build -o mtfosbot .
|
RUN make
|
||||||
|
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
RUN apk add --no-cache ca-certificates
|
RUN apk add --no-cache ca-certificates
|
||||||
|
9
Makefile
Normal file
9
Makefile
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
.PHONY: clean build
|
||||||
|
|
||||||
|
build:
|
||||||
|
go-bindata -pkg schema -ignore .git -o module/schema/static.go schema/
|
||||||
|
GOOS=linux go build -o mtfosbot .
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf mtfosbot && go clean
|
@ -10,6 +10,7 @@ twitch:
|
|||||||
sub_secret: ''
|
sub_secret: ''
|
||||||
chat_host: ''
|
chat_host: ''
|
||||||
bot_oauth: ''
|
bot_oauth: ''
|
||||||
|
bot_user: ''
|
||||||
google:
|
google:
|
||||||
api_key: ''
|
api_key: ''
|
||||||
database:
|
database:
|
||||||
|
@ -25,6 +25,7 @@ type Config struct {
|
|||||||
SubSecret string `yaml:"sub_secret"`
|
SubSecret string `yaml:"sub_secret"`
|
||||||
ChatHost string `yaml:"chat_host"`
|
ChatHost string `yaml:"chat_host"`
|
||||||
BotOauth string `yaml:"bot_oauth"`
|
BotOauth string `yaml:"bot_oauth"`
|
||||||
|
BotUser string `yaml:"bot_user"`
|
||||||
} `yaml:"twitch"`
|
} `yaml:"twitch"`
|
||||||
Google struct {
|
Google struct {
|
||||||
APIKey string `yaml:"api_key"`
|
APIKey string `yaml:"api_key"`
|
||||||
|
@ -33,7 +33,7 @@ func InitIRC() {
|
|||||||
ReJoin()
|
ReJoin()
|
||||||
|
|
||||||
config := irc.ClientConfig{
|
config := irc.ClientConfig{
|
||||||
Nick: "mtfos",
|
Nick: conf.Twitch.BotUser,
|
||||||
Pass: conf.Twitch.BotOauth,
|
Pass: conf.Twitch.BotOauth,
|
||||||
Handler: irc.HandlerFunc(ircHandle),
|
Handler: irc.HandlerFunc(ircHandle),
|
||||||
}
|
}
|
||||||
|
@ -43,12 +43,8 @@ func NewServ() *gin.Engine {
|
|||||||
|
|
||||||
// SetRoutes - set routes
|
// SetRoutes - set routes
|
||||||
func SetRoutes(r *gin.Engine) {
|
func SetRoutes(r *gin.Engine) {
|
||||||
r.NoRoute(func(c *gin.Context) {
|
|
||||||
fmt.Println("match not route")
|
|
||||||
c.String(404, "404 page not found")
|
|
||||||
})
|
|
||||||
|
|
||||||
r.GET("/", func(c *gin.Context) {
|
r.GET("/", func(c *gin.Context) {
|
||||||
|
fmt.Println("in next")
|
||||||
c.JSON(200, gin.H{
|
c.JSON(200, gin.H{
|
||||||
"message": "ok",
|
"message": "ok",
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user