Set up reflex for make watch

This commit is contained in:
Benedikt Kulmann
2020-07-01 11:05:33 +02:00
parent 28e72bc5ad
commit f883c5bd0b
8 changed files with 57 additions and 46 deletions
+24
View File
@@ -3,6 +3,7 @@ package assets
import (
"net/http"
"os"
"path"
"github.com/owncloud/ocis-accounts/pkg/config"
"github.com/owncloud/ocis-pkg/v2/log"
@@ -18,6 +19,29 @@ type assets struct {
// Open just implements the HTTP filesystem interface.
func (a assets) Open(original string) (http.File, error) {
if a.config.Asset.Path != "" {
if stat, err := os.Stat(a.config.Asset.Path); err == nil && stat.IsDir() {
custom := path.Join(
a.config.Asset.Path,
original,
)
if _, err := os.Stat(custom); !os.IsNotExist(err) {
f, err := os.Open(custom)
if err != nil {
return nil, err
}
return f, nil
}
} else {
a.logger.Warn().
Str("path", a.config.Asset.Path).
Msg("Assets directory doesn't exist")
}
}
return FS.OpenFile(
CTX,
original,
+3 -3
View File
File diff suppressed because one or more lines are too long