show client config in log only in verbose mode; actions changes

This commit is contained in:
Ilya Sosnovsky 2021-10-15 07:54:24 +03:00
parent c1970c26e4
commit 8db6d93bcb
3 changed files with 16 additions and 9 deletions

View File

@ -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 }}.
asset_name: ovpn-admin-${{ matrix.goos }}-${{ matrix.goarch }}.

View File

@ -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

13
main.go
View File

@ -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)
}