mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 06:40:54 +03:00
add support for build tag to allow to disable some features
The following build tags are available: - "nogcs", disable Google Cloud Storage backend - "nos3", disable S3 Compabible Object Storage backends - "nobolt", disable Bolt data provider - "nomysql", disable MySQL data provider - "nopgsql", disable PostgreSQL data provider - "nosqlite", disable SQLite data provider - "noportable", disable portable mode
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package utils
|
||||
|
||||
import "strings"
|
||||
|
||||
const version = "0.9.6-dev"
|
||||
|
||||
var (
|
||||
@@ -10,21 +12,34 @@ var (
|
||||
|
||||
// VersionInfo defines version details
|
||||
type VersionInfo struct {
|
||||
Version string `json:"version"`
|
||||
BuildDate string `json:"build_date"`
|
||||
CommitHash string `json:"commit_hash"`
|
||||
Version string `json:"version"`
|
||||
BuildDate string `json:"build_date"`
|
||||
CommitHash string `json:"commit_hash"`
|
||||
Features []string `json:"features"`
|
||||
}
|
||||
|
||||
// GetVersionAsString returns the string representation of the VersionInfo struct
|
||||
func (v *VersionInfo) GetVersionAsString() string {
|
||||
versionString := v.Version
|
||||
var sb strings.Builder
|
||||
sb.WriteString(v.Version)
|
||||
if len(v.CommitHash) > 0 {
|
||||
versionString += "-" + v.CommitHash
|
||||
sb.WriteString("-")
|
||||
sb.WriteString(v.CommitHash)
|
||||
}
|
||||
if len(v.BuildDate) > 0 {
|
||||
versionString += "-" + v.BuildDate
|
||||
sb.WriteString("-")
|
||||
sb.WriteString(v.BuildDate)
|
||||
}
|
||||
return versionString
|
||||
if len(v.Features) > 0 {
|
||||
sb.WriteString(" ")
|
||||
sb.WriteString(strings.Join(v.Features, " "))
|
||||
}
|
||||
return sb.String()
|
||||
}
|
||||
|
||||
// AddFeature adds a feature description
|
||||
func AddFeature(feature string) {
|
||||
versionInfo.Features = append(versionInfo.Features, feature)
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
Reference in New Issue
Block a user