projects
/
brevno-suite
/
hugo
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
be9df84
)
absurl: export a base url var for testing
author
bep
<bjorn.erik.pedersen@gmail.com>
Fri, 1 May 2015 10:29:10 +0000
(12:29 +0200)
committer
bep
<bjorn.erik.pedersen@gmail.com>
Fri, 1 May 2015 10:29:03 +0000
(12:29 +0200)
transform/absurl.go
patch
|
blob
|
history
diff --git
a/transform/absurl.go
b/transform/absurl.go
index 89727a705689efbf9f47603303e5c3515bc0b38b..75dbe4db377baf161514f18136f0ca2a77558696 100644
(file)
--- 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)
})
}