@@ -28,7 +28,7 @@ func idx(w http.ResponseWriter, r *http.Request) {
28
28
// TODO: Return error page
29
29
}
30
30
idxStr := string (idx )
31
- idxStr = util .ReplaceBase (idxStr , "base href=\" /\" " , "base href=\" %s\" " )
31
+ idxStr = util .ReplaceBasePath (idxStr , "base href=\" /\" " , "base href=\" %s\" " )
32
32
io .WriteString (w , idxStr )
33
33
}
34
34
@@ -129,7 +129,7 @@ func getVersion(w http.ResponseWriter, r *http.Request) {
129
129
func main () {
130
130
c := config .LoadConfig (version )
131
131
132
- util .UpdateBase (c .Web .BaseURL )
132
+ util .SetBasePath (c .Web .BaseURL )
133
133
134
134
log .Infof ("Terraboard v%s is starting..." , version )
135
135
@@ -157,28 +157,28 @@ func main() {
157
157
defer database .Close ()
158
158
159
159
// Index is a wildcard for all paths
160
- http .HandleFunc (util .AddBase ("" ), idx )
160
+ http .HandleFunc (util .GetFullPath ("" ), idx )
161
161
162
162
// Serve static files (CSS, JS, images) from dir
163
163
staticFs := http .FileServer (http .Dir ("static" ))
164
- http .Handle (util .AddBase ("static/" ), http .StripPrefix (util .AddBase ("static" ), staticFs ))
164
+ http .Handle (util .GetFullPath ("static/" ), http .StripPrefix (util .GetFullPath ("static" ), staticFs ))
165
165
166
166
// Handle API points
167
- http .HandleFunc (util .AddBase ("api/version" ), getVersion )
168
- http .HandleFunc (util .AddBase ("api/user" ), api .GetUser )
169
- http .HandleFunc (util .AddBase ("api/states" ), handleWithDB (api .ListStates , database ))
170
- http .HandleFunc (util .AddBase ("api/states/stats" ), handleWithDB (api .ListStateStats , database ))
171
- http .HandleFunc (util .AddBase ("api/states/tfversion/count" ), handleWithDB (api .ListTerraformVersionsWithCount , database ))
172
- http .HandleFunc (util .AddBase ("api/state/" ), handleWithDB (api .GetState , database ))
173
- http .HandleFunc (util .AddBase ("api/state/activity/" ), handleWithDB (api .GetStateActivity , database ))
174
- http .HandleFunc (util .AddBase ("api/state/compare/" ), handleWithDB (api .StateCompare , database ))
175
- http .HandleFunc (util .AddBase ("api/locks" ), api .GetLocks )
176
- http .HandleFunc (util .AddBase ("api/search/attribute" ), handleWithDB (api .SearchAttribute , database ))
177
- http .HandleFunc (util .AddBase ("api/resource/types" ), handleWithDB (api .ListResourceTypes , database ))
178
- http .HandleFunc (util .AddBase ("api/resource/types/count" ), handleWithDB (api .ListResourceTypesWithCount , database ))
179
- http .HandleFunc (util .AddBase ("api/resource/names" ), handleWithDB (api .ListResourceNames , database ))
180
- http .HandleFunc (util .AddBase ("api/attribute/keys" ), handleWithDB (api .ListAttributeKeys , database ))
181
- http .HandleFunc (util .AddBase ("api/tf_versions" ), handleWithDB (api .ListTfVersions , database ))
167
+ http .HandleFunc (util .GetFullPath ("api/version" ), getVersion )
168
+ http .HandleFunc (util .GetFullPath ("api/user" ), api .GetUser )
169
+ http .HandleFunc (util .GetFullPath ("api/states" ), handleWithDB (api .ListStates , database ))
170
+ http .HandleFunc (util .GetFullPath ("api/states/stats" ), handleWithDB (api .ListStateStats , database ))
171
+ http .HandleFunc (util .GetFullPath ("api/states/tfversion/count" ), handleWithDB (api .ListTerraformVersionsWithCount , database ))
172
+ http .HandleFunc (util .GetFullPath ("api/state/" ), handleWithDB (api .GetState , database ))
173
+ http .HandleFunc (util .GetFullPath ("api/state/activity/" ), handleWithDB (api .GetStateActivity , database ))
174
+ http .HandleFunc (util .GetFullPath ("api/state/compare/" ), handleWithDB (api .StateCompare , database ))
175
+ http .HandleFunc (util .GetFullPath ("api/locks" ), api .GetLocks )
176
+ http .HandleFunc (util .GetFullPath ("api/search/attribute" ), handleWithDB (api .SearchAttribute , database ))
177
+ http .HandleFunc (util .GetFullPath ("api/resource/types" ), handleWithDB (api .ListResourceTypes , database ))
178
+ http .HandleFunc (util .GetFullPath ("api/resource/types/count" ), handleWithDB (api .ListResourceTypesWithCount , database ))
179
+ http .HandleFunc (util .GetFullPath ("api/resource/names" ), handleWithDB (api .ListResourceNames , database ))
180
+ http .HandleFunc (util .GetFullPath ("api/attribute/keys" ), handleWithDB (api .ListAttributeKeys , database ))
181
+ http .HandleFunc (util .GetFullPath ("api/tf_versions" ), handleWithDB (api .ListTfVersions , database ))
182
182
183
183
// Start server
184
184
log .Fatal (http .ListenAndServe (fmt .Sprintf (":%v" , c .Port ), nil ))
0 commit comments