small fixes

This commit is contained in:
Ilya Sosnovsky 2021-02-19 09:45:26 +03:00
parent 4abbc1a308
commit 6b60439325
2 changed files with 3 additions and 9 deletions

View File

@ -1,6 +1,6 @@
FROM golang:1.14.2-buster AS builder
COPY . /app
RUN cd /app && env CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags='-linkmode external -extldflags "-static" -s -w' -o openvpn-user
RUN cd /app && CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags='-linkmode external -extldflags "-static" -s -w' -o openvpn-user
FROM alpine:3.13
WORKDIR /app

View File

@ -11,7 +11,7 @@ import (
)
const (
version = "1.0.3-alpha"
version = "1.0.3-rc.1"
)
var (
@ -49,7 +49,6 @@ var (
debug = kingpin.Flag("debug", "Enable debug mode.").Default("false").Bool()
versionCommand = kingpin.Command("version", "Show version.")
)
type User struct {
@ -61,7 +60,7 @@ type User struct {
}
func main() {
kingpin.Version(version)
switch kingpin.Parse() {
case createCommand.FullCommand():
createUser(*createCommandUserFlag, *createCommandPasswordFlag)
@ -83,13 +82,8 @@ func main() {
initDb()
case dbMigrateCommand.FullCommand():
migrateDb()
case versionCommand.FullCommand():
showVersion()
}
}
func showVersion() {
fmt.Printf("openvpn-user: version %s n", version)
}
func getDb() *sql.DB {
db, err := sql.Open("sqlite3", *dbPath)