Fixes #1559
This commit is contained in:
@@ -58,12 +58,18 @@ func buildConfig(bundledFiles fs.FS, args []string) *server.ServerConfig {
|
||||
log.Println("Client log push enabled")
|
||||
}
|
||||
|
||||
rootSpaceConfig.GitIgnore = os.Getenv("SB_SPACE_IGNORE")
|
||||
|
||||
if os.Getenv("SB_SPACE_IGNORE") != "" {
|
||||
log.Printf("Ignoring files matching: %s", os.Getenv("SB_SPACE_IGNORE"))
|
||||
}
|
||||
|
||||
if rootSpaceConfig.SpaceFolderPath == "" {
|
||||
log.Fatal("No folder specified. Please pass a folder as an argument or set SB_FOLDER environment variable.")
|
||||
}
|
||||
|
||||
var spacePrimitives server.SpacePrimitives
|
||||
spacePrimitives, err := server.NewDiskSpacePrimitives(rootSpaceConfig.SpaceFolderPath, os.Getenv("SB_GIT_IGNORE"))
|
||||
spacePrimitives, err := server.NewDiskSpacePrimitives(rootSpaceConfig.SpaceFolderPath, rootSpaceConfig.GitIgnore)
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
@@ -115,12 +121,6 @@ func buildConfig(bundledFiles fs.FS, args []string) *server.ServerConfig {
|
||||
log.Println("Starting in read-only mode.")
|
||||
}
|
||||
|
||||
rootSpaceConfig.GitIgnore = os.Getenv("SB_GIT_IGNORE")
|
||||
|
||||
if os.Getenv("SB_SPACE_IGNORE") != "" {
|
||||
log.Printf("Ignoring files matching: %s", os.Getenv("SB_SPACE_IGNORE"))
|
||||
}
|
||||
|
||||
if os.Getenv("SB_URL_PREFIX") != "" {
|
||||
hostUrlPrefix := os.Getenv("SB_URL_PREFIX")
|
||||
// Normalize the host URL prefix (if set)
|
||||
|
||||
@@ -37,7 +37,7 @@ func TestSafePath(t *testing.T) {
|
||||
assert.NoError(t, err, "Valid relative path should not error")
|
||||
}
|
||||
|
||||
func TestGitIngore(t *testing.T) {
|
||||
func TestGitIgnore(t *testing.T) {
|
||||
space, err := NewDiskSpacePrimitives(t.TempDir(), "*.txt\n*.jpg")
|
||||
assert.NoError(t, err, "Failed to create DiskSpacePrimitives")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user