mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-28 03:53:33 +00:00
feat: add identity_file field to config connections config
This commit is contained in:
@@ -5,8 +5,21 @@ import (
|
||||
"os"
|
||||
"os/user"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func ExpandHomeDir(path string) string {
|
||||
if len(path) == 0 {
|
||||
return path
|
||||
}
|
||||
if path[0] == '~' {
|
||||
// TODO: Improve compat with other OSes
|
||||
path = strings.Replace(path, "~", "${HOME}", 1)
|
||||
return os.ExpandEnv(path)
|
||||
}
|
||||
return path
|
||||
}
|
||||
|
||||
// LookupUIDGID returns the user and group IDs for the given username.
|
||||
func LookupUIDGID(username string) (uid, gid int, err error) {
|
||||
usr, err := user.Lookup(username)
|
||||
|
||||
Reference in New Issue
Block a user