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 support for Sematext Cloud Europe #6

Closed
otisg opened this issue Sep 1, 2017 · 8 comments
Closed

Add support for Sematext Cloud Europe #6

otisg opened this issue Sep 1, 2017 · 8 comments

Comments

@otisg
Copy link
Member

otisg commented Sep 1, 2017

Maybe via:
logsene config set --region eu

@mduvanel
Copy link
Contributor

Any news on this issue?
If possible I would gladly try to contribute for it as I am quite interested in using a CLI tool for SemaText.

@otisg
Copy link
Member Author

otisg commented Jan 23, 2019

A PR would be great, @mduvanel !

@mbonaci
Copy link
Member

mbonaci commented Jan 25, 2019

@mduvanel If you're interested, there's a branch region that I pushed yesterday.
master needs to be merged into it (locally, of course) and then tested.
The public API changed in the meantime and those changes are also in the region branch.
Here's the API spec, just in case you need it: https://apps.sematext.com/api-explorer
Ask if you need help

@mduvanel
Copy link
Contributor

@mbonaci Thank you, I will pull this branch and work from there.
I was confused yesterday because I could not get even plain curl authentication requests to work with API v2 as mentioned in this ticket to work, but I will have a look at the API explorer to understand what I am doing wrong - and use v3 now.

@mduvanel
Copy link
Contributor

Just a thought: as I am trying to switch between an EU-based login and a US-based login for comparison, I realise there is no documented way to explicitly end a session.
Would it make sense to add a logout option of some sort? Could be done in a separate issue though.

@mduvanel
Copy link
Contributor

mduvanel commented Jan 27, 2019

After playing around with a first implementation, I have the feeling that a property that can be set is not the best way to handle the region.

With this model, one has to start by setting the region using logsene-cli config set --region EU. Since the user is not logged in yet, he will have to login first in order for the command to execute properly. However login will fail because user cannot login using his EU login, since the config is not set yet... This is a chicken-and-egg problem.

Also, changing the region after you are logged in does not really make sense, because a login is valid for a region and not necessarily the other. At best, setting the region would have to force a logout.

To me it feels that the region is closely tied to the login action, and it would make more sense to ask for the region even before the username and password. Something like this:

$> logsene-cli search -q ERROR
No active sessions. Please log in using your Sematext account:
Enter your region (default is US): EU
Enter your username: foo@bar.com
Enter your password:
Successfuly logged in and retrieved API key.
...

Once the region is set it should be saved for the session, because all subsequent requests should be using the same region-specific URI. So it would make sense to keep track of the regionproperty like it is done for username, but not expose it through the config API.

Do you agree with this proposal?

@mbonaci
Copy link
Member

mbonaci commented Jan 29, 2019

I initially thought I'd let users keep both sessions alive (with region-apiKey stored in config) at the same time and allow "switching" between them without the need to logout/login, but that may end up being too complicated and likely confusing.
So yes, I agree with your proposal.

@mbonaci
Copy link
Member

mbonaci commented Feb 5, 2019

BTW @mduvanel, the logout command is a great suggestion, now that there's a need to switch between regions.
I'm opening a separate issue for that - #11.
I bumped the version to v2.3.0 and published it to npm.

@mbonaci mbonaci closed this as completed Feb 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants