Add Umask support

This commit is contained in:
Mukhtar Akere
2025-03-15 21:30:19 +01:00
parent b4e4db27fb
commit e2ff3b26de
2 changed files with 14 additions and 1 deletions

View File

@@ -5,7 +5,7 @@ tmp_dir = "tmp"
[build] [build]
args_bin = ["--config", "data/"] args_bin = ["--config", "data/"]
bin = "./tmp/main" bin = "./tmp/main"
cmd = "bash -c 'go build -ldflags \"-X github.com/sirrobot01/debrid-blackhole/pkg/version.Version=0.0.0 -X github.com/sirrobot01/debrid-blackhole/pkg/version.Channel=nightly\" -o ./tmp/main .'" cmd = "bash -c 'go build -ldflags \"-X github.com/sirrobot01/debrid-blackhole/pkg/version.Version=0.0.0 -X github.com/sirrobot01/debrid-blackhole/pkg/version.Channel=dev\" -o ./tmp/main .'"
delay = 1000 delay = 1000
exclude_dir = ["assets", "tmp", "vendor", "testdata", "data"] exclude_dir = ["assets", "tmp", "vendor", "testdata", "data"]
exclude_file = [] exclude_file = []

View File

@@ -12,11 +12,24 @@ import (
"github.com/sirrobot01/debrid-blackhole/pkg/version" "github.com/sirrobot01/debrid-blackhole/pkg/version"
"github.com/sirrobot01/debrid-blackhole/pkg/web" "github.com/sirrobot01/debrid-blackhole/pkg/web"
"github.com/sirrobot01/debrid-blackhole/pkg/worker" "github.com/sirrobot01/debrid-blackhole/pkg/worker"
"os"
"runtime/debug" "runtime/debug"
"strconv"
"sync" "sync"
"syscall"
) )
func Start(ctx context.Context) error { func Start(ctx context.Context) error {
if umaskStr := os.Getenv("UMASK"); umaskStr != "" {
umask, err := strconv.ParseInt(umaskStr, 8, 32)
if err != nil {
return fmt.Errorf("invalid UMASK value: %s", umaskStr)
}
// Set umask
syscall.Umask(int(umask))
}
cfg := config.GetConfig() cfg := config.GetConfig()
var wg sync.WaitGroup var wg sync.WaitGroup
errChan := make(chan error) errChan := make(chan error)