Skip to content

Commit

Permalink
修改配置
Browse files Browse the repository at this point in the history
  • Loading branch information
togettoyou committed Jul 14, 2021
1 parent 61e3fa4 commit ed632f3
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 15 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ WORKDIR /root/togettoyou/super-signature
RUN make docs

FROM togettoyou/isign:latest
COPY --from=builder /root/togettoyou/super-signature/app /root/togettoyou/super-signature/
COPY --from=builder /root/togettoyou/super-signature/super-signature-app /root/togettoyou/super-signature/
COPY --from=builder /root/togettoyou/super-signature/conf/ /root/togettoyou/super-signature/conf/
WORKDIR /root/togettoyou/super-signature
EXPOSE 8888
ENTRYPOINT ["./app"]
ENTRYPOINT ["./super-signature-app"]
17 changes: 9 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,30 @@
.PHONY: all docs linux linux-docs run gotool clean help

# 生成的二进制文件名
BINARY_NAME="app"
BINARY_NAME="super-signature-app"
MODULE_NAME="super-signature"
TARGET=$(out)

# 编译添加版本信息
versionDir = "${BINARY_NAME}/util/version"
versionDir = "${MODULE_NAME}/util/version"
gitTag = $(shell if [ "`git describe --tags --abbrev=0 2>/dev/null`" != "" ];then git describe --tags --abbrev=0; else git log --pretty=format:'%h' -n 1; fi)
buildDate = $(shell TZ=Asia/Shanghai date +%FT%T%z)
gitCommit = $(shell git log --pretty=format:'%H' -n 1)
gitTreeState = $(shell if git status|grep -q 'clean';then echo clean; else echo dirty; fi)
ldflags="-w -X ${versionDir}.gitTag=${gitTag} -X ${versionDir}.buildDate=${buildDate} -X ${versionDir}.gitCommit=${gitCommit} -X ${versionDir}.gitTreeState=${gitTreeState}"

# 执行make命令时所执行的所有命令
all: gotool clean
go build -v -ldflags ${ldflags} -o ${BINARY_NAME} .
all: clean
CGO_ENABLED=0 go build -v -ldflags ${ldflags} -o ${BINARY_NAME} .

docs: gotool clean
go build -tags "docs" -v -ldflags ${ldflags} -o ${BINARY_NAME} .
docs: clean
CGO_ENABLED=0 go build -tags "docs" -v -ldflags ${ldflags} -o ${BINARY_NAME} .

# 交叉编译linux amd64版本
linux: gotool clean
linux: clean
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -ldflags ${ldflags} -o ${BINARY_NAME} .

linux-docs: gotool clean
linux-docs: clean
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags "docs" -v -ldflags ${ldflags} -o ${BINARY_NAME} .

# 运行项目
Expand Down
2 changes: 1 addition & 1 deletion config.yaml → conf/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ server:
# 日志配置
logConfig:
# 日志记录模式 fatal,panic,dpanic,error,warn,info,debug
level: debug
level: info
# 日志是否记录到文件 true,false
isFile: false
# 普通日志文件存放位置,当 isFile 为 true 时生效
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ services:
ports:
- "8888:8888"
volumes:
- ./conf:/root/togettoyou/super-signature/conf
- ./ios:/root/togettoyou/super-signature/ios
- ./router/templates:/root/togettoyou/super-signature/router/templates
- ./config.yaml:/root/togettoyou/super-signature/config.yaml
- ./ios.csr:/root/togettoyou/super-signature/ios.csr
- ./ios.key:/root/togettoyou/super-signature/ios.key
- ./server.crt:/root/togettoyou/super-signature/server.crt
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func setup() {

var (
v = pflag.BoolP("version", "v", false, "显示版本信息")
config = pflag.StringP("config", "c", "config.yaml", "指定配置文件路径")
config = pflag.StringP("config", "c", "conf/config.yaml", "指定配置文件路径")
)

// @title iOS超级签名
Expand Down
2 changes: 1 addition & 1 deletion server.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# 启动服务名
SERVER_NAME="app"
SERVER_NAME="super-signature-app"
BASE_DIR=$PWD
INTERVAL=2

Expand Down
2 changes: 1 addition & 1 deletion util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import (

// Reset 重设配置
func Reset() {
zap.L().Info("Hot reload config.")
conf.Reset()
logger.Reset()
model.Reset()
resetGinMode()
zap.L().Info("Hot reload config.")
}

const (
Expand Down

0 comments on commit ed632f3

Please sign in to comment.