1
0

/info endpoint (#85)

This commit is contained in:
konrad
2019-07-15 22:54:38 +00:00
committed by Gitea
parent c3ea45d900
commit e2d9de191d
11 changed files with 200 additions and 36 deletions

View File

@ -28,9 +28,6 @@ import (
"os"
)
// Version sets the version to be printed to the user. Gets overwritten by "make release" or "make build" with last git commit or tag.
var Version = "0.1"
func init() {
cobra.OnInitialize(initialize)
}

View File

@ -17,6 +17,7 @@
package cmd
import (
"code.vikunja.io/api/pkg/version"
"fmt"
"github.com/spf13/cobra"
)
@ -29,6 +30,6 @@ var versionCmd = &cobra.Command{
Use: "version",
Short: "Print the version number of Vikunja",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("Vikunja api version " + Version)
fmt.Println("Vikunja api version " + version.Version)
},
}

View File

@ -21,6 +21,7 @@ import (
"code.vikunja.io/api/pkg/log"
"code.vikunja.io/api/pkg/routes"
"code.vikunja.io/api/pkg/swagger"
"code.vikunja.io/api/pkg/version"
"context"
"fmt"
"github.com/spf13/cobra"
@ -39,10 +40,10 @@ var webCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
// Version notification
fmt.Printf("Vikunja version %s\n", Version)
fmt.Printf("Vikunja version %s\n", version.Version)
// Additional swagger information
swagger.SwaggerInfo.Version = Version
swagger.SwaggerInfo.Version = version.Version
// Start the webserver
e := routes.NewEcho()