diff options
Diffstat (limited to 'transform')
-rw-r--r-- | transform/absurl.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/transform/absurl.go b/transform/absurl.go index 89727a705..75dbe4db3 100644 --- a/transform/absurl.go +++ b/transform/absurl.go @@ -5,6 +5,9 @@ import ( "sync" ) +// to be used in tests; the live site will get its value from Viper. +var AbsBaseUrl string + var absURLInit sync.Once var ar *absURLReplacer @@ -42,6 +45,14 @@ func absURLInXMLFromReplacer(ar *absURLReplacer) (trs []link, err error) { func initAbsURLReplacer() { absURLInit.Do(func() { - ar = newAbsURLReplacer(viper.GetString("BaseURL")) + var url string + + if AbsBaseUrl != "" { + url = AbsBaseUrl + } else { + url = viper.GetString("BaseURL") + } + + ar = newAbsURLReplacer(url) }) } |