Merge branch 'main' into docs-styling

This commit is contained in:
Michael Quigley 2025-05-06 20:46:05 -04:00
commit cb618ce877
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
2 changed files with 13 additions and 7 deletions

View File

@ -1,5 +1,9 @@
# CHANGELOG
## v1.0.5
FIX: `zrok enable` now handles the case where the user ID does not resolve to a username when generating the default environment description (https://github.com/openziti/zrok/issues/959)
## v1.0.4
FIX: `zrok admin bootstrap` and `zrok enable` functionality were broken in `v1.0.3`. A bad combination of dependencies caused issues with marshalling data from the associated controller endpoints

View File

@ -56,14 +56,16 @@ func (cmd *enableCommand) run(_ *cobra.Command, args []string) {
panic(err)
}
var username string
user, err := user2.Current()
if err != nil {
username := os.Getenv("USER")
if username == "" {
logrus.Panicf("unable to determine the current user: %v", err)
}
userObj, err := user2.Current()
if err == nil && userObj.Username != "" {
username = userObj.Username
} else {
username = user.Username
username = os.Getenv("USER")
if username == "" {
euid := os.Geteuid()
username = fmt.Sprintf("user-%d", euid)
logrus.Warnf("unable to determine the current user, using effective UID: %v", euid)
}
}
hostDetail = fmt.Sprintf("%v; %v", username, hostDetail)
if cmd.description == "<user>@<hostname>" {