FS: Get CDN prefix from configuration (#110615)
* FS: Get CDN prefix from configuration * undo logger change * fix tests * add unused property * tests * fix tests * remove dead comment
This commit is contained in:
@@ -60,7 +60,7 @@ func GetWebAssets(ctx context.Context, cfg *setting.Cfg, license licensing.Licen
|
||||
}
|
||||
|
||||
if result == nil {
|
||||
result, err = readWebAssetsFromFile(filepath.Join(cfg.StaticRootPath, "build", "assets-manifest.json"))
|
||||
result, err = ReadWebAssetsFromFile(filepath.Join(cfg.StaticRootPath, "build", "assets-manifest.json"))
|
||||
if err == nil {
|
||||
cdn, _ = cfg.GetContentDeliveryURL(license.ContentDeliveryPrefix())
|
||||
if cdn != "" {
|
||||
@@ -73,7 +73,7 @@ func GetWebAssets(ctx context.Context, cfg *setting.Cfg, license licensing.Licen
|
||||
return entryPointAssetsCache, err
|
||||
}
|
||||
|
||||
func readWebAssetsFromFile(manifestpath string) (*dtos.EntryPointAssets, error) {
|
||||
func ReadWebAssetsFromFile(manifestpath string) (*dtos.EntryPointAssets, error) {
|
||||
//nolint:gosec
|
||||
f, err := os.Open(manifestpath)
|
||||
if err != nil {
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
func TestReadWebassets(t *testing.T) {
|
||||
assets, err := readWebAssetsFromFile("testdata/sample-assets-manifest.json")
|
||||
assets, err := ReadWebAssetsFromFile("testdata/build/assets-manifest.json")
|
||||
require.NoError(t, err)
|
||||
|
||||
dto, err := json.MarshalIndent(assets, "", " ")
|
||||
|
||||
Reference in New Issue
Block a user