mirror of
https://github.com/OliveTin/OliveTin
synced 2026-09-05 01:15:38 +00:00
Search additional dirs for the webui dir
This commit is contained in:
@@ -23,12 +23,16 @@ type webUISettings struct {
|
||||
func findWebuiDir() string {
|
||||
directoriesToSearch := []string{
|
||||
"./webui",
|
||||
"/usr/share/OliveTin/webui/",
|
||||
"/var/www/olivetin/",
|
||||
"/etc/OliveTin/webui/",
|
||||
}
|
||||
|
||||
for _, dir := range directoriesToSearch {
|
||||
if _, err := os.Stat(dir); !os.IsNotExist(err) {
|
||||
log.Infof("Found the webui directory here: %v", dir)
|
||||
log.WithFields(log.Fields{
|
||||
"dir": dir,
|
||||
}).Infof("Found the webui directory")
|
||||
|
||||
return dir
|
||||
}
|
||||
|
||||
@@ -3,9 +3,12 @@ package httpservers
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
"os"
|
||||
)
|
||||
|
||||
func TestGetWebuiDir(t *testing.T) {
|
||||
os.Chdir("../../") // go test sets the cwd to "httpservers" by default
|
||||
|
||||
dir := findWebuiDir()
|
||||
|
||||
assert.Equal(t, "./webui", dir, "Finding the webui dir")
|
||||
|
||||
Reference in New Issue
Block a user