1
0
mirror of https://github.com/IceWhaleTech/CasaOS.git synced 2025-07-06 23:37:26 +02:00
Files
CasaOS/pkg/utils/env_helper/env.go

27 lines
566 B
Go
Raw Normal View History

package env_helper
import "strings"
2021-12-29 16:42:20 +08:00
func ReplaceDefaultENV(key, tz string) string {
temp := ""
switch key {
case "$DefaultPassword":
temp = "casaos"
case "$DefaultUserName":
temp = "admin"
2021-12-29 16:42:20 +08:00
case "$PUID":
temp = "1000"
case "$PGID":
temp = "1000"
case "$TZ":
temp = tz
}
return temp
}
//replace env default setting
func ReplaceStringDefaultENV(str string) string {
2021-12-29 16:42:20 +08:00
return strings.ReplaceAll(strings.ReplaceAll(str, "$DefaultPassword", ReplaceDefaultENV("$DefaultPassword", "")), "$DefaultUserName", ReplaceDefaultENV("$DefaultUserName", ""))
}