diff --git a/server/.idea/dataSources.xml b/server/.idea/dataSources.xml deleted file mode 100644 index 776c738..0000000 --- a/server/.idea/dataSources.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - sqlite.xerial - true - org.sqlite.JDBC - jdbc:sqlite:identifier.sqlite - $ProjectFileDir$ - - - \ No newline at end of file diff --git a/server/api/router.go b/server/api/router.go index 3443436..8065f98 100644 --- a/server/api/router.go +++ b/server/api/router.go @@ -61,9 +61,7 @@ func (r *Router) Init(e *gin.Engine) { docs := e.Group("/documentation") { docs.GET("/swagger", ginext.RedirectTemporary("/documentation/swagger/")) - docs.GET("/swagger/", ginresp.Wrap(swagger.Handle)) - docs.GET("/swagger/:fn1", ginresp.Wrap(swagger.Handle)) - docs.GET("/swagger/:fn1/:fn2", ginresp.Wrap(swagger.Handle)) + docs.GET("/swagger/*sub", ginresp.Wrap(swagger.Handle)) } // ================ Website ================ diff --git a/server/cmd/scnserver/main.go b/server/cmd/scnserver/main.go index 854e731..23c8f8d 100644 --- a/server/cmd/scnserver/main.go +++ b/server/cmd/scnserver/main.go @@ -13,9 +13,9 @@ import ( "github.com/rs/zerolog/log" ) -var conf = scn.Conf - func main() { + conf := scn.Conf + scn.Init(conf) log.Info().Msg(fmt.Sprintf("Starting with config-namespace <%s>", conf.Namespace)) diff --git a/server/swagger/swagger.go b/server/swagger/swagger.go index 816ecb7..bf31359 100644 --- a/server/swagger/swagger.go +++ b/server/swagger/swagger.go @@ -47,8 +47,7 @@ func getAsset(fn string) ([]byte, string, bool) { func Handle(g *gin.Context) ginresp.HTTPResponse { type uri struct { - Filename1 string `uri:"fn1"` - Filename2 *string `uri:"fn2"` + Filename string `uri:"sub"` } var u uri @@ -56,19 +55,16 @@ func Handle(g *gin.Context) ginresp.HTTPResponse { return ginresp.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) } - filename := u.Filename1 - if u.Filename2 != nil { - filename = filename + "/" + *u.Filename2 - } + u.Filename = strings.TrimLeft(u.Filename, "/") - if filename == "" { + if u.Filename == "" { index, _, _ := getAsset("index.html") return ginresp.Data(http.StatusOK, "text/html", index) } - if data, mime, ok := getAsset(filename); ok { + if data, mime, ok := getAsset(u.Filename); ok { return ginresp.Data(http.StatusOK, mime, data) } - return ginresp.JSON(http.StatusNotFound, gin.H{"error": "AssetNotFound", "filename": filename, "filename1": u.Filename1, "filename2": u.Filename2}) + return ginresp.JSON(http.StatusNotFound, gin.H{"error": "AssetNotFound", "filename": u.Filename}) }