Skip to content

Commit

Permalink
show client config in log only in verbose mode; actions changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pashcovich committed Oct 15, 2021
1 parent c1970c2 commit 8db6d93
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}.
8 changes: 7 additions & 1 deletion install-deps.sh
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -11,3 +16,4 @@ cd frontend && npm install && npm run build && cd ..

packr2

export CGO_ENABLED=1
13 changes: 6 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 8db6d93

Please sign in to comment.