1. add makefile
2. modify dockerfile
3. add config twitch.bot_user
This commit is contained in:
Jay 2018-09-20 20:35:04 +08:00
parent 116c43b0cb
commit 8a4b11f92a
6 changed files with 16 additions and 7 deletions

View File

@ -1,7 +1,9 @@
FROM golang:1.11-alpine3.8 as builder
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 . .
RUN GOOS=linux go build -o mtfosbot .
RUN make
FROM alpine:latest
RUN apk add --no-cache ca-certificates

9
Makefile Normal file
View 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

View File

@ -10,6 +10,7 @@ twitch:
sub_secret: ''
chat_host: ''
bot_oauth: ''
bot_user: ''
google:
api_key: ''
database:

View File

@ -25,6 +25,7 @@ type Config struct {
SubSecret string `yaml:"sub_secret"`
ChatHost string `yaml:"chat_host"`
BotOauth string `yaml:"bot_oauth"`
BotUser string `yaml:"bot_user"`
} `yaml:"twitch"`
Google struct {
APIKey string `yaml:"api_key"`

View File

@ -33,7 +33,7 @@ func InitIRC() {
ReJoin()
config := irc.ClientConfig{
Nick: "mtfos",
Nick: conf.Twitch.BotUser,
Pass: conf.Twitch.BotOauth,
Handler: irc.HandlerFunc(ircHandle),
}

View File

@ -43,12 +43,8 @@ func NewServ() *gin.Engine {
// SetRoutes - set routes
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) {
fmt.Println("in next")
c.JSON(200, gin.H{
"message": "ok",
})