Giter Site home page Giter Site logo

Comments (8)

mduvanel avatar mduvanel commented on August 30, 2024 1

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.

from logsene-cli.

mduvanel avatar mduvanel commented on August 30, 2024 1

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: [email protected]
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?

from logsene-cli.

mduvanel avatar mduvanel commented on August 30, 2024

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.

from logsene-cli.

otisg avatar otisg commented on August 30, 2024

A PR would be great, @mduvanel !

from logsene-cli.

mbonaci avatar mbonaci commented on August 30, 2024

@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

from logsene-cli.

mduvanel avatar mduvanel commented on August 30, 2024

@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.

from logsene-cli.

mbonaci avatar mbonaci commented on August 30, 2024

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.

from logsene-cli.

mbonaci avatar mbonaci commented on August 30, 2024

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.

from logsene-cli.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.