Skip to content

Commit

Permalink
Fix makefile for real
Browse files Browse the repository at this point in the history
  • Loading branch information
punmechanic committed Nov 21, 2024
1 parent f2574e9 commit 6f897de
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 27 deletions.
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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/:
Expand Down
6 changes: 6 additions & 0 deletions command/consts.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package command

import "log"

// Vars for build time
var (
ClientID string
Expand All @@ -20,3 +22,7 @@ const (
// DefaultTimeRemaining for new key requests in minutes
DefaultTimeRemaining uint = 5
)

func init() {
log.Println(ClientID)
}
22 changes: 0 additions & 22 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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() {
Expand Down

0 comments on commit 6f897de

Please sign in to comment.