Files
warewulf/internal/pkg/version/version.go
Jonathon Anderson 70292276e2 Rename BaseConf.New to BaseConf.Get
Since BaseConf.New could return a cached BaseConf, rather than always
constructing a new struct, I've renamed it to Get to more accurately
reflect its use. A new New() method is called by Get and always
initializes a new struct.

Signed-off-by: Jonathon Anderson <janderson@ciq.co>
2023-04-19 14:02:43 -06:00

28 lines
600 B
Go

package version
import (
"fmt"
"github.com/hpcng/warewulf/internal/pkg/api/routes/wwapiv1"
warewulfconf "github.com/hpcng/warewulf/internal/pkg/config"
)
/*
Return the version of wwctl
*/
func GetVersion() string {
conf := warewulfconf.Get()
return fmt.Sprintf("%s-%s", conf.Paths.Version, conf.Paths.Release)
}
/*
Returns the version of the api via grpc
*/
func Version() (versionResponse *wwapiv1.VersionResponse) {
versionResponse = &wwapiv1.VersionResponse{}
versionResponse.ApiPrefix = "rc1"
versionResponse.ApiVersion = "1"
versionResponse.WarewulfVersion = GetVersion()
return
}