show client config in log only in verbose mode; actions changes
This commit is contained in:
parent
c1970c26e4
commit
8db6d93bcb
3 changed files with 16 additions and 9 deletions
4
.github/workflows/release.yaml
vendored
4
.github/workflows/release.yaml
vendored
|
@ -6,6 +6,8 @@ jobs:
|
||||||
releases-matrix:
|
releases-matrix:
|
||||||
name: Release Go Binary
|
name: Release Go Binary
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
CGO_ENABLED: 1
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
# build and publish in parallel: linux/386, linux/amd64, windows/386, windows/amd64, darwin/386, darwin/amd64
|
# 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'
|
ldflags: '-linkmode external -extldflags "-static" -s -w'
|
||||||
pre_command: bash ./install-deps.sh
|
pre_command: bash ./install-deps.sh
|
||||||
binary_name: "ovpn-admin"
|
binary_name: "ovpn-admin"
|
||||||
asset_name: ovpn-admin-${{ matrix.goos }}-${{ matrix.goarch }}.
|
asset_name: ovpn-admin-${{ matrix.goos }}-${{ matrix.goarch }}.
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
|
||||||
apt-get update
|
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
|
PATH=$PATH:~/go/bin
|
||||||
|
|
||||||
|
@ -11,3 +16,4 @@ cd frontend && npm install && npm run build && cd ..
|
||||||
|
|
||||||
packr2
|
packr2
|
||||||
|
|
||||||
|
export CGO_ENABLED=1
|
||||||
|
|
13
main.go
13
main.go
|
@ -578,20 +578,19 @@ func (oAdmin *OvpnAdmin) renderClientConfig(username string) string {
|
||||||
var tmp bytes.Buffer
|
var tmp bytes.Buffer
|
||||||
err := t.Execute(&tmp, conf)
|
err := t.Execute(&tmp, conf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Printf("ERROR: something goes wrong during rendering config for %s\n", username )
|
||||||
log.Printf("WARNING: something goes wrong during rendering config for %s\n", username )
|
|
||||||
if *debug {
|
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
|
hosts = nil
|
||||||
|
if *verbose {
|
||||||
fmt.Printf("%+v\n", tmp.String())
|
log.Printf("INFO: Rendered config for user %s: %+v\n", username, tmp.String())
|
||||||
|
}
|
||||||
return fmt.Sprintf("%+v\n", 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)
|
return fmt.Sprintf("User \"%s\" not found", username)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue