add version info in output
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
8
main.go
8
main.go
@@ -21,8 +21,13 @@ type Output struct {
|
|||||||
CertLoaded bool
|
CertLoaded bool
|
||||||
Results string
|
Results string
|
||||||
Groups string
|
Groups string
|
||||||
|
Version string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For build numbers, from https://blog.kowalczyk.info/article/vEja/embedding-build-number-in-go-executable.html
|
||||||
|
var sha1ver string // sha1 revision used to build the program
|
||||||
|
var buildTime string // when the executable was built
|
||||||
|
|
||||||
func GetFilePath(path string) string {
|
func GetFilePath(path string) string {
|
||||||
// Check for empty filename
|
// Check for empty filename
|
||||||
if len(path) == 0 {
|
if len(path) == 0 {
|
||||||
@@ -121,6 +126,8 @@ func GetGroupsOfUser(username string, baseDN string, conn *ldap.Conn) ([]string,
|
|||||||
return groups, nil
|
return groups, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Some good ideas at https://gist.github.com/tboerger/4840e1b5464fc26fbb165b168be23345
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var output Output
|
var output Output
|
||||||
|
|
||||||
@@ -133,6 +140,7 @@ func main() {
|
|||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
output.Server = *server
|
output.Server = *server
|
||||||
|
output.Version = fmt.Sprintf("Built on %s from sha1 %s\n", buildTime, sha1ver)
|
||||||
|
|
||||||
// Get a copy of the system defined CA's
|
// Get a copy of the system defined CA's
|
||||||
system, err := x509.SystemCertPool()
|
system, err := x509.SystemCertPool()
|
||||||
|
Reference in New Issue
Block a user