fix: ensure chowned properties always have a user and group set
Depending on the execution path, the variables may not be set at the top-level. Closes #3328
This commit is contained in:
1 parent
2f2136af09
commit
615119260d
2 files changed
+11
-1
No files matched your search
@@ -144,6 +144,13 @@ func setPermissions(path string, fileMode os.FileMode) (err error) {
|
|||||||
|
|
||||||
systemGroup := os.Getenv("DOKKU_SYSTEM_GROUP")
|
systemGroup := os.Getenv("DOKKU_SYSTEM_GROUP")
|
||||||
systemUser := os.Getenv("DOKKU_SYSTEM_USER")
|
systemUser := os.Getenv("DOKKU_SYSTEM_USER")
|
||||||
|
if systemGroup == "" {
|
||||||
|
systemGroup = "dokku"
|
||||||
|
}
|
||||||
|
if systemUser == "" {
|
||||||
|
systemUser = "dokku"
|
||||||
|
}
|
||||||
|
|
||||||
group, err := user.LookupGroup(systemGroup)
|
group, err := user.LookupGroup(systemGroup)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -67,7 +67,10 @@ fn-plugin-property-setup() {
|
|||||||
|
|
||||||
mkdir -p "${DOKKU_LIB_ROOT}/config/${PLUGIN}"
|
mkdir -p "${DOKKU_LIB_ROOT}/config/${PLUGIN}"
|
||||||
chmod 0755 "${DOKKU_LIB_ROOT}/config/${PLUGIN}"
|
chmod 0755 "${DOKKU_LIB_ROOT}/config/${PLUGIN}"
|
||||||
chown "${DOKKU_SYSTEM_USER}:${DOKKU_SYSTEM_GROUP}" "${DOKKU_LIB_ROOT}/config/${PLUGIN}"
|
|
||||||
|
local dokku_system_group=${DOKKU_SYSTEM_GROUP:="dokku"}
|
||||||
|
local dokku_system_user=${DOKKU_SYSTEM_USER:="dokku"}
|
||||||
|
chown "${dokku_system_user}:${dokku_system_group}" "${DOKKU_LIB_ROOT}/config/${PLUGIN}"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn-plugin-property-read() {
|
fn-plugin-property-read() {
|
||||||
|
|||||||
Reference in new issue
Block a user