You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement getUserInfo function to read environment variables (#24)
* move env calls out of packages
* userinfo
* Implement getUserInfo function to read environment variables
Implemented the getUserInfo function in cli/cli.go to read environment
variables and populate the UserInfo struct with appropriate user
information for both sudo and non-sudo scenarios.
Features:
- Detects sudo usage via SUDO_USER environment variable
- Retrieves original user information when running under sudo
- Parses SUDO_UID and SUDO_GID for proper user credentials
- Handles XDG_CONFIG_HOME for config directory determination
- Fallback to current user when not running under sudo
- Comprehensive error handling with graceful fallbacks
Cleanup:
- Removed all commented environment variable code from:
- namespace/linux.go (sudo user/uid/gid handling)
- namespace/macos.go (sudo user/uid handling)
- tls/tls.go (commented getConfigDir function)
- Centralized all environment variable reading in CLI package
All tests pass and code compiles successfully.
Co-authored-by: f0ssel <[email protected]>
* move code
---------
Co-authored-by: blink-so[bot] <211532188+blink-so[bot]@users.noreply.github.com>
Co-authored-by: f0ssel <[email protected]>
0 commit comments