Rename UID and GID to PUID and PGID

This commit is contained in:
Quentin McGaw
2020-12-29 16:44:35 +00:00
parent 8d5f2fec09
commit cb64302294
14 changed files with 68 additions and 59 deletions

View File

@@ -33,8 +33,8 @@ type Reader interface {
GetDNSKeepNameserver() (on bool, err error)
// System
GetUID() (uid int, err error)
GetGID() (gid int, err error)
GetPUID() (puid int, err error)
GetPGID() (pgid int, err error)
GetTimezone() (timezone string, err error)
GetPublicIPFilepath() (filepath models.Filepath, err error)

View File

@@ -4,14 +4,20 @@ import (
libparams "github.com/qdm12/golibs/params"
)
// GetUID obtains the user ID to use from the environment variable UID.
func (r *reader) GetUID() (uid int, err error) {
return r.envParams.GetEnvIntRange("UID", 0, 65535, libparams.Default("1000"))
// GetPUID obtains the user ID to use from the environment variable PUID
// with retro compatible variable UID.
func (r *reader) GetPUID() (ppuid int, err error) {
return r.envParams.GetEnvIntRange("PUID", 0, 65535,
libparams.Default("1000"),
libparams.RetroKeys([]string{"UID"}, r.onRetroActive))
}
// GetGID obtains the group ID to use from the environment variable GID.
func (r *reader) GetGID() (gid int, err error) {
return r.envParams.GetEnvIntRange("GID", 0, 65535, libparams.Default("1000"))
// GetGID obtains the group ID to use from the environment variable PGID
// with retro compatible variable PGID.
func (r *reader) GetPGID() (pgid int, err error) {
return r.envParams.GetEnvIntRange("PGID", 0, 65535,
libparams.Default("1000"),
libparams.RetroKeys([]string{"GID"}, r.onRetroActive))
}
// GetTZ obtains the timezone from the environment variable TZ.