Comments (8)
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.
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 region
property like it is done for username
, but not expose it through the config API.
Do you agree with this proposal?
from logsene-cli.
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.
A PR would be great, @mduvanel !
from logsene-cli.
@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.
@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.
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.
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)
- Use --token instead of --api-key HOT 2
- SSL & proxy issues HOT 7
- Maximum call stack size exceeded on node.js 6.x HOT 4
- Error on search: TypeError: Cannot read property 'defaultOperator' of undefined HOT 6
- Login doesn't work HOT 13
- Issue when attempting to specify which fields to bring back using -f HOT 5
- Add logout command HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from logsene-cli.