Move static to resources. Embed them at build time

This commit is contained in:
Deluan
2020-05-01 14:35:57 -04:00
committed by Deluan Quintão
parent b7dcdedf41
commit 1a9663d432
13 changed files with 39 additions and 367 deletions
+6
View File
@@ -0,0 +1,6 @@
_ _ _ _
| \ | | (_) | |
| \| | __ ___ ___ __| |_ __ ___ _ __ ___ ___
| . ` |/ _` \ \ / / |/ _` | '__/ _ \| '_ ` _ \ / _ \
| |\ | (_| |\ V /| | (_| | | | (_) | | | | | | __/
\_| \_/\__,_| \_/ |_|\__,_|_| \___/|_| |_| |_|\___|
+28
View File
@@ -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")
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB