1
0
Fork 0
mirror of synced 2024-11-24 01:45:35 -05:00

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 FROM golang:1.14.2-buster AS builder
COPY . /app 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 FROM alpine:3.13
WORKDIR /app WORKDIR /app

View file

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