summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2020-03-10 19:30:08 -0400
committerMicah Anderson <micah@riseup.net>2020-03-10 19:30:08 -0400
commitd39373b769c9e5224aa65a6d7fd4444e93a7f336 (patch)
tree4f9920ba44091b2f842fe067b27290c9ebd44416 /main.go
parent9fc3cfbc852cee3587e4011c805067d9c182f886 (diff)
[bug] Fix pathing for provider.json.
This `web.HttpFileHandler(srv, "/provider.json", opts.ApiPath+"provider.json")` should have been `opts.ApiPath+"/provider.json"`. The difference is there was a missing / before provider.json. That results in vpnweb trying to open a path that doesn't exist: /etc/leap/config/vpnprovider.json. Because this is so hard to see, its better to use filepath.Join, so these things cannot happen. So I've switched these to the standard library function that joins paths.
Diffstat (limited to 'main.go')
-rw-r--r--main.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/main.go b/main.go
index 8fb802d..c43edb7 100644
--- a/main.go
+++ b/main.go
@@ -3,6 +3,7 @@ package main
import (
"log"
"net/http"
+ "path/filepath"
"0xacab.org/leap/vpnweb/pkg/auth"
"0xacab.org/leap/vpnweb/pkg/config"
@@ -28,10 +29,10 @@ func main() {
/* static files */
- web.HttpFileHandler(srv, "/3/configs.json", opts.ApiPath+"/3/configs.json")
- web.HttpFileHandler(srv, "/3/service.json", opts.ApiPath+"/3/service.json")
- web.HttpFileHandler(srv, "/3/config/eip-service.json", opts.ApiPath+"/3/eip-service.json")
- web.HttpFileHandler(srv, "/provider.json", opts.ApiPath+"provider.json")
+ web.HttpFileHandler(srv, "/3/configs.json", filepath.Join(opts.ApiPath, "3", "configs.json"))
+ web.HttpFileHandler(srv, "/3/service.json", filepath.Join(opts.ApiPath, "3", "service.json"))
+ web.HttpFileHandler(srv, "/3/config/eip-service.json", filepath.Join(opts.ApiPath, "3", "eip-service.json"))
+ web.HttpFileHandler(srv, "/provider.json", filepath.Join(opts.ApiPath, "provider.json"))
web.HttpFileHandler(srv, "/ca.crt", opts.ProviderCaPath)
web.HttpFileHandler(srv, "/3/ca.crt", opts.ProviderCaPath)