From 8db6d93bcbc6df6da7f90375a8293d9d995916a9 Mon Sep 17 00:00:00 2001 From: Ilya Sosnovsky Date: Fri, 15 Oct 2021 07:54:24 +0300 Subject: [PATCH] show client config in log only in verbose mode; actions changes --- .github/workflows/release.yaml | 4 +++- install-deps.sh | 8 +++++++- main.go | 13 ++++++------- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 61935b9..6594d45 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -6,6 +6,8 @@ jobs: releases-matrix: name: Release Go Binary runs-on: ubuntu-latest + env: + CGO_ENABLED: 1 strategy: matrix: # build and publish in parallel: linux/386, linux/amd64, windows/386, windows/amd64, darwin/386, darwin/amd64 @@ -23,4 +25,4 @@ jobs: ldflags: '-linkmode external -extldflags "-static" -s -w' pre_command: bash ./install-deps.sh binary_name: "ovpn-admin" - asset_name: ovpn-admin-${{ matrix.goos }}-${{ matrix.goarch }}. \ No newline at end of file + asset_name: ovpn-admin-${{ matrix.goos }}-${{ matrix.goarch }}. diff --git a/install-deps.sh b/install-deps.sh index 6a43e77..65af8a9 100755 --- a/install-deps.sh +++ b/install-deps.sh @@ -1,7 +1,12 @@ #!/usr/bin/env bash + apt-get update -apt-get install -y npm nodejs +apt-get install -y curl +apt-get install -y gcc-multilib libc6-dev-i386 linux-libc-dev:i386 + +curl -sL https://deb.nodesource.com/setup_14.x | sudo bash - +apt-get install -y nodejs PATH=$PATH:~/go/bin @@ -11,3 +16,4 @@ cd frontend && npm install && npm run build && cd .. packr2 +export CGO_ENABLED=1 diff --git a/main.go b/main.go index f3dcc9d..0fc6669 100644 --- a/main.go +++ b/main.go @@ -578,20 +578,19 @@ func (oAdmin *OvpnAdmin) renderClientConfig(username string) string { var tmp bytes.Buffer err := t.Execute(&tmp, conf) if err != nil { - - log.Printf("WARNING: something goes wrong during rendering config for %s\n", username ) + log.Printf("ERROR: something goes wrong during rendering config for %s\n", username ) if *debug { - log.Printf("ERROR: rendering config for %s failed \n %v\n", username, err ) - + log.Printf("DEBUG: rendering config for %s failed with error %v\n", username, err ) } } hosts = nil - - fmt.Printf("%+v\n", tmp.String()) + if *verbose { + log.Printf("INFO: Rendered config for user %s: %+v\n", username, tmp.String()) + } return fmt.Sprintf("%+v\n", tmp.String()) } - fmt.Printf("User \"%s\" not found", username) + log.Printf("WARNING: User \"%s\" not found", username) return fmt.Sprintf("User \"%s\" not found", username) }