Skip to content

src login command to help users configure authentication w/access token#317

Merged
sqs merged 2 commits into
mainfrom
login
Sep 16, 2020
Merged

src login command to help users configure authentication w/access token#317
sqs merged 2 commits into
mainfrom
login

Conversation

@sqs

@sqs sqs commented Sep 14, 2020

Copy link
Copy Markdown
Member

You can run src login https://sourcegraph.example.com to verify that your src is authenticated to access that Sourcegraph instance. If not, it'll show you friendly steps to help you get it set up.

This will simplify all of our docs and in-product text that relies on users using the CLI. The steps to get them to the right state will be just:

  1. Install the Sourcegraph CLI (src) at https://github.com/sourcegraph/src-cli [or link to releases]
  2. Run src login SOURCEGRAPH_URL [and we can even fill in SOURCEGRAPH_URL in in-product text]

Here is a screenshot of what it looks like in various states:

image
image

README section:

image

@sqs sqs marked this pull request as draft September 14, 2020 05:08
Comment thread cmd/src/main.go Outdated

type configSource int

const (

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This stuff ended up being unnecessary, will revert.

Comment thread cmd/src/main.go Outdated
AccessToken string `json:"accessToken"`
AdditionalHeaders map[string]string `json:"additionalHeaders"`

EndpointSource configSource

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This stuff ended up being unnecessary, will revert.

Comment thread cmd/src/main.go
}
var cfg config
if err == nil {
cfg.ConfigFilePath = cfgPath

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This stuff ended up being unnecessary, will revert.

@sqs

sqs commented Sep 14, 2020

Copy link
Copy Markdown
Member Author

@slimsag mentioned (on Slack):

Nice, one idea would be to have it automatically populate your .profile or something

My reply:

I thought about having it automatically update your .profile, but that is tricky to get right, esp. when many people would be using this with multiple instances (could be good in the future though).
Or it could tell you things like "Or you can copy/paste this into your .profile: export SRC_ENDPOINT=... ...", but that adds a lot of noise and most users right now would not need that hand-holding.

@LawnGnome

Copy link
Copy Markdown
Contributor

We could have this populate the config file instead, except I'd suggest that we should simultaneously migrate that file from being ~/src-config.json to something less intrusive and more in line with platform norms (path.Join(os.UserConfigDir(), "sourcegraph", "src-cli.json"), or something similar?).

@sqs

sqs commented Sep 15, 2020

Copy link
Copy Markdown
Member Author

@LawnGnome We've deprecated the config file and are supporting only env var config. See #156 (comment) and #205.

@LawnGnome

Copy link
Copy Markdown
Contributor

@LawnGnome We've deprecated the config file and are supporting only env var config. See #156 (comment) and #205.

Fair enough. Thanks for the context!

@sqs sqs force-pushed the login branch 2 times, most recently from 547bc04 to 807feac Compare September 15, 2020 04:10
You can run `src login https://sourcegraph.example.com` to verify that your `src` is authenticated to access that Sourcegraph instance. If not, it'll show you friendly steps to help you get it set up.

This will simplify all of our docs and in-product text that relies on users using the CLI. The steps to get them to the right state will be just:

1. Install the Sourcegraph CLI (`src`) at https://github.com/sourcegraph/src-cli [or link to releases]
1. Run `src login SOURCEGRAPH_URL` [and we can even fill in `SOURCEGRAPH_URL` in in-product text]

Also adds a deprecation warning if you have an old-style `src-config.json` file, and updates the README.md to highlight the `src login` command.
@sqs sqs marked this pull request as ready for review September 15, 2020 04:14

@mrnugget mrnugget left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this!

@sqs sqs merged commit ea6f381 into main Sep 16, 2020
@sqs sqs deleted the login branch September 16, 2020 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants