Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flag for csm port #75

Merged
merged 1 commit into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion iamlivecore/csm.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func listenForEvents() {
var iamMap iamMapBase

addr := net.UDPAddr{
Port: 31000,
Port: *csmPortFlag,
IP: net.ParseIP(*hostFlag),
}
conn, err := net.ListenUDP("udp", &addr)
Expand Down
5 changes: 4 additions & 1 deletion iamlivecore/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var backgroundFlag *bool
var debugFlag *bool
var forceWildcardResourceFlag *bool
var cpuProfileFlag = flag.String("cpu-profile", "", "write a CPU profile to this file (for performance testing purposes)")
var csmPortFlag *int

func parseConfig() {
provider := "aws"
Expand All @@ -48,6 +49,7 @@ func parseConfig() {
background := false
debug := false
forceWildcardResource := false
csmPort := 31000

cfgfile, err := homedir.Expand("~/.iamlive/config")
if err == nil {
Expand Down Expand Up @@ -120,6 +122,7 @@ func parseConfig() {
backgroundFlag = flag.Bool("background", background, "when set, the process will return the current PID and run in the background without output")
debugFlag = flag.Bool("debug", debug, "dumps associated HTTP requests when set in proxy mode")
forceWildcardResourceFlag = flag.Bool("force-wildcard-resource", forceWildcardResource, "when set, the Resource will always be a wildcard")
csmPortFlag = flag.Int("csm-port", csmPort, "port to listen on for CSM")
}

func Run() {
Expand Down Expand Up @@ -161,7 +164,7 @@ func Run() {
if *providerFlag == "aws" {
setINIConfigAndFileFlush()
}

loadMaps()

if *modeFlag == "csm" && *providerFlag == "aws" {
Expand Down