mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
0d7b33022c
This commit adjusts the build flags to include version information in the LDFLAGS using the -X options. Additionally this makes the information recorded at build time more comprehensive. All build information can now be obtained via the `authelia build` command, and the `authelia version` command is now `authelia --version`. Lastly this adjusts the Dockerfile to utilize docker cache more effectively.
40 lines
760 B
Go
40 lines
760 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func init() {
|
|
xflagsCmd.Flags().StringP("build", "b", "0", "Sets the BuildNumber flag value")
|
|
xflagsCmd.Flags().StringP("extra", "e", "", "Sets the BuildExtra flag value")
|
|
}
|
|
|
|
var xflagsCmd = &cobra.Command{
|
|
Use: "xflags",
|
|
Run: runXFlags,
|
|
Short: "Generate X LDFlags for building Authelia",
|
|
}
|
|
|
|
func runXFlags(cobraCmd *cobra.Command, _ []string) {
|
|
build, err := cobraCmd.Flags().GetString("build")
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
extra, err := cobraCmd.Flags().GetString("extra")
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
flags, err := getXFlags("", build, extra)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
fmt.Println(strings.Join(flags, " "))
|
|
}
|