The Version (e,g, 4.4 ), Release (git hash) and Confversion (e.g. 44) must be compiled into the code so that they can't be changed during run time and ensure this with the compiler Signed-off-by: Christian Goll <cgoll@suse.com>
27 lines
582 B
Go
27 lines
582 B
Go
package version
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/warewulf/warewulf/internal/pkg/api/routes/wwapiv1"
|
|
warewulfconf "github.com/warewulf/warewulf/internal/pkg/config"
|
|
)
|
|
|
|
/*
|
|
Return the version of wwctl
|
|
*/
|
|
func GetVersion() string {
|
|
return fmt.Sprintf("%s-%s", warewulfconf.Version, warewulfconf.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
|
|
}
|