From 9335166836488b8bafd1cc24cb01a44b538b9d95 Mon Sep 17 00:00:00 2001 From: Igor Montagner Date: Tue, 26 Oct 2021 08:01:23 -0300 Subject: [PATCH] [GH 483] Linux-app: discover executable folder and use it in config instead of ./ (#1613) * Discover executable folder and use it in config instead of ./ * Use camel case. --- linux/main.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/linux/main.go b/linux/main.go index 76d62988b..54d0fca3b 100644 --- a/linux/main.go +++ b/linux/main.go @@ -4,7 +4,10 @@ import ( "fmt" "log" "net" + "os" "os/exec" + "path" + "path/filepath" "runtime" "github.com/google/uuid" @@ -34,16 +37,19 @@ func getFreePort() (int, error) { func runServer(port int) (*server.Server, error) { logger, _ := mlog.NewLogger() + executable, _ := os.Executable() + executableDir, _ := filepath.EvalSymlinks(filepath.Dir(executable)) + config := &config.Configuration{ ServerRoot: fmt.Sprintf("http://localhost:%d", port), Port: port, DBType: "sqlite3", - DBConfigString: "./focalboard.db", + DBConfigString: path.Join(executableDir, "focalboard.db"), UseSSL: false, SecureCookie: true, - WebPath: "./pack", + WebPath: path.Join(executableDir, "pack"), FilesDriver: "local", - FilesPath: "./focalboard_files", + FilesPath: path.Join(executableDir, "focalboard_files"), Telemetry: true, WebhookUpdate: []string{}, SessionExpireTime: 259200000000,