diff --git a/Makefile b/Makefile index 6187e681..c4cea1c4 100644 --- a/Makefile +++ b/Makefile @@ -56,11 +56,11 @@ bin/keyconjurer: bin/ @go build \ -ldflags "\ -s -w \ - -X main.Version=$(shell git rev-parse --short HEAD)-$(RELEASE) \ - -X main.ClientID=$(CLIENT_ID) \ - -X main.OIDCDomain=$(OIDC_DOMAIN) \ - -X main.BuildTimestamp='$(TIMESTAMP)' \ - -X main.ServerAddress=$(SERVER_ADDRESS)" \ + -X github.com/riotgames/key-conjurer/command.Version=$(shell git rev-parse --short HEAD)-$(RELEASE) \ + -X github.com/riotgames/key-conjurer/command.ClientID=$(CLIENT_ID) \ + -X github.com/riotgames/key-conjurer/command.OIDCDomain=$(OIDC_DOMAIN) \ + -X github.com/riotgames/key-conjurer/command.BuildTimestamp='$(TIMESTAMP)' \ + -X github.com/riotgames/key-conjurer/command.ServerAddress=$(SERVER_ADDRESS)" \ -o bin/$(BUILD_TARGET) bin/: diff --git a/command/consts.go b/command/consts.go index 7a1ce273..d67c8f35 100644 --- a/command/consts.go +++ b/command/consts.go @@ -1,5 +1,7 @@ package command +import "log" + // Vars for build time var ( ClientID string @@ -20,3 +22,7 @@ const ( // DefaultTimeRemaining for new key requests in minutes DefaultTimeRemaining uint = 5 ) + +func init() { + log.Println(ClientID) +} diff --git a/main.go b/main.go index 365eda74..2dfa7880 100644 --- a/main.go +++ b/main.go @@ -21,20 +21,6 @@ const ( WSAEACCES = 10013 ) -// Vars for build time -var ( - ClientID string - OIDCDomain string - ServerAddress string - Version = "TBD" - BuildTimestamp = "BuildTimestamp is not set" - // CallbackPorts is a list of ports that will be attempted in no particular order for hosting an Oauth2 callback web server. - // This cannot be set using -ldflags='-X ..' because -X requires that this be a string literal or uninitialized. - // - // These ports are chosen somewhat arbitrarily - CallbackPorts = []string{"57468", "47512", "57123", "61232", "48231", "49757", "59834", "54293"} -) - // IsWindowsPortAccessError determines if the given error is the error WSAEACCES. func IsWindowsPortAccessError(err error) bool { var syscallErr *syscall.Errno @@ -49,14 +35,6 @@ func init() { handler := slog.NewTextHandler(os.Stdout, &opts) slog.SetDefault(slog.New(handler)) - - // Manually copy consts to command package. - command.ClientID = ClientID - command.OIDCDomain = OIDCDomain - command.ServerAddress = ServerAddress - command.Version = Version - command.BuildTimestamp = BuildTimestamp - command.CallbackPorts = CallbackPorts } func main() {