mirror of
https://github.com/grafana/grafana.git
synced 2025-07-30 14:42:16 +08:00
Plugins: Fix plugins CDN not working when plugins are not in domain's root path (#63202)
* Plugins CDN: Add support for different CDN root path * Plugins CDN: Make frontendsettings return the correct CDN base path * Update comments * Fix version detection * Undo frontend changes * Fix system.js asset path construction * fix(plugins): translate all plugin css asset paths loaded via cdn * refactor(plugins): rename extractPluginNameVersionFromUrl and add comments * Fix typo in comment Co-authored-by: Will Browne <wbrowne@users.noreply.github.com> * Hardcode CDN URL structure /{id}/{version}/public/plugins/{id}/{assetPath} is not required anymore in the cdn url template config --------- Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com> Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
This commit is contained in:
@ -9,7 +9,7 @@ import (
|
||||
|
||||
func TestService(t *testing.T) {
|
||||
svc := ProvideService(&config.Cfg{
|
||||
PluginsCDNURLTemplate: "https://cdn.example.com/{id}/{version}/public/plugins/{id}/{assetPath}",
|
||||
PluginsCDNURLTemplate: "https://cdn.example.com",
|
||||
PluginSettings: map[string]map[string]string{
|
||||
"one": {"cdn": "true"},
|
||||
"two": {},
|
||||
@ -30,8 +30,8 @@ func TestService(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
name: "valid",
|
||||
cfgURL: "https://grafana-assets.grafana.net/plugin-cdn-test/plugin-cdn/{id}/{version}/public/plugins/{id}/{assetPath}",
|
||||
expBaseURL: "https://grafana-assets.grafana.net",
|
||||
cfgURL: "https://grafana-assets.grafana.net/plugin-cdn-test/plugin-cdn",
|
||||
expBaseURL: "https://grafana-assets.grafana.net/plugin-cdn-test/plugin-cdn",
|
||||
},
|
||||
{
|
||||
name: "empty",
|
||||
|
Reference in New Issue
Block a user