Closed xmudrii closed 7 years ago
hey @xmudrii
this project is still working. when I do this:
$ dorepl -api.token "lolll"
dorepl: can't query DigitalOcean account, is your token valid?
it works for me...! I don't have a Windows machine, but if you feel like investigating, I'll be happy to look at a patch!
hi @aybabtme
it's almost same output for me when I enter random token like that:
dorepl: can't query DigitalOcean account, is your token valid?
invalid character 'U' looking for beginning of value
(same command), i just have one more error. but when i supply valid token, i get error like i reported
i'll try some debugging and if i find something, i'll report back
invalid character 'U' looking for beginning of value
is a bug with the API right now, peeps are working on it :P
Seems tho that the API toke is being passed.
I changed env var to DO_TOKEN
and got logged in. I'm trying to trace issue, i'll report here with my findings
@aybabtme I found something. Don't you mind please explaining me a thing? Here's what I found:
In cmd/dorepl/main.go
at the line 95, it says:
if len(os.Args[1:]) == 0
.
Shouldn't it be if len(os.Args[1:]) != 0
instead? When I change it, it works. logged in successfully. But I guess it will not work if you have token set as the default environmental variable (such as DO_TOKEN
).
Do you have any idea how we can fix this one?
Hah good find! The problem is that os.Args
returns exactly the args as they are given to the process, including the -api.token
flag. To get the args without the parsed flags, the code should be using flag.Args()
instead :)
@aybabtme changing if
to if len(flag.Args()) == 0 {
seems to work for all variants (flag provided, default env variable, repl file such as one from the example). If you want I can create PR. I can also let you do it, if you want. :D
I'm good, happy to let you do it if you feel like it.
hey y'all
i found this project randomly, is this thing still working? i saw some commits from past few hours.
i dl-ed this, but when i try to auth using my token:
it returns me following err:
i tried many combinations, including: writing it directly (without env var), writing it with ", ' or even without it, and many others... token is working very well with other api services (e.g. doctl), even generated new one just in case.
tyvm
ps. working on bash for windows (ubuntu 16.04): tried with both bash and zsh, no avail
/cc @aybabtme @iheanyi