Move static to resources. Embed them at build time
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
// +build !embed
|
||||
|
||||
package resources
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"sync"
|
||||
|
||||
"github.com/deluan/navidrome/log"
|
||||
)
|
||||
|
||||
var once sync.Once
|
||||
|
||||
func Asset(filePath string) ([]byte, error) {
|
||||
f, err := AssetFile().Open(filePath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ioutil.ReadAll(f)
|
||||
}
|
||||
|
||||
func AssetFile() http.FileSystem {
|
||||
once.Do(func() {
|
||||
log.Warn("Using external resources from 'resources' folder")
|
||||
})
|
||||
return http.Dir("resources")
|
||||
}
|
||||
Reference in New Issue
Block a user