Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 80aaf62

Browse files
committed
🎨 b3log#223
1 parent 82dd0e6 commit 80aaf62

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

main.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ func replaceServerConf() {
134134
logger.Fatal("read file [" + path + "] failed: " + err.Error())
135135
}
136136
content := string(data)
137-
content = strings.Replace(content, "${Server}", model.Conf.Server, -1)
138-
content = strings.Replace(content, "${StaticServer}", model.Conf.StaticServer, -1)
139-
writePath := strings.TrimRight(path, ".tpl")
137+
content = strings.Replace(content, "http://server.tpl.json", model.Conf.Server, -1)
138+
content = strings.Replace(content, "http://staticserver.tpl.json", model.Conf.StaticServer, -1)
139+
writePath := strings.TrimSuffix(path, ".tpl")
140140
if e = ioutil.WriteFile(writePath, []byte(content), 0644); nil != e {
141141
logger.Fatal("replace server conf in [" + writePath + "] failed: " + err.Error())
142142
}
@@ -145,15 +145,15 @@ func replaceServerConf() {
145145

146146
if util.File.IsExist("console/dist/") { // not exist if npm run dev
147147
err = filepath.Walk(filepath.ToSlash("console/dist/"), func(path string, f os.FileInfo, err error) error {
148-
if strings.HasSuffix(path, ".html") {
148+
if strings.HasSuffix(path, ".html.tpl") {
149149
data, e := ioutil.ReadFile(path)
150150
if nil != e {
151151
logger.Fatal("read file [" + path + "] failed: " + err.Error())
152152
}
153153
content := string(data)
154-
content = strings.Replace(content, "${Server}", model.Conf.Server, -1)
155-
content = strings.Replace(content, "${StaticServer}", model.Conf.StaticServer, -1)
156-
writePath := strings.TrimRight(path, ".tpl")
154+
content = strings.Replace(content, "http://server.tpl.json", model.Conf.Server, -1)
155+
content = strings.Replace(content, "http://staticserver.tpl.json", model.Conf.StaticServer, -1)
156+
writePath := strings.TrimSuffix(path, ".tpl")
157157
if e = ioutil.WriteFile(writePath, []byte(content), 0644); nil != e {
158158
logger.Fatal("replace server conf in [" + writePath + "] failed: " + err.Error())
159159
}

0 commit comments

Comments
 (0)