If the api key is set through env variable and doesn't contain a '.' the cli crashes
root@ee83d788528f:/# export LUDUS_API_KEY='BLAH'
root@ee83d788528f:/# ./ludus range config get
panic: runtime error: slice bounds out of range [:-1]
goroutine 1 [running]:
ludus/rest.InitClient({0xc0000283d8, 0x17}, {0xc000028026, 0x4}, {0x0, 0x0}, 0x0, 0x0, {0xc000014c90, 0xe})
ludus/rest/restapi.go:31 +0x645
ludus/cmd.init.func7(0xc0001c4700?, {0xe20480, 0x0, 0x95712f?})
ludus/cmd/range.go:175 +0x86
github.com/spf13/cobra.(*Command).execute(0xdb34e0, {0xe20480, 0x0, 0x0})
github.com/spf13/cobra@v1.8.0/command.go:987 +0xab1
github.com/spf13/cobra.(*Command).ExecuteC(0xdb4ec0)
github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
github.com/spf13/cobra@v1.8.0/command.go:1039
ludus/cmd.Execute()
ludus/cmd/root.go:52 +0x1a
main.main()
ludus/main.go:6 +0xf
Issue appears to be caused by only checking for string length before getting a slice of the string: https://gitlab.com/badsectorlabs/ludus/-/blob/main/ludus-client/rest/restapi.go?ref_type=heads#L31