[src-cli] add ability to set/update site config options (similar to `src config` and `src extsvc`)
Created by: dadlerj
Requested by:
See https://sourcegraph.slack.com/archives/CJX299FGE/p1593025084425300 for some internal discussion on this topic.
Problem description and proposal
My description of the challenge that the customer listed above is facing:
Well — if every value was stored in a distinct database field (and we had a page with a series of radio buttons and input boxes for settings), then it’d be easy to very quickly update a single field via a simple REST API call. As it currently stands, a user has to first get the full config, parse it to remove all of the escaped newlines/etc., edit the JSON (and hopefully you’re using a library that checks for errors), then structure a GQL API call with the correct ID and properly escaped (?) config value… It’s just a decent amount of extra work for what seems like a simple operation.
Not a big deal, and I might be overestimating the complexity (e.g. maybe they just start from scratch each time instead of editing the current config?) but still not the most user-friendly process.
And @slimsag 's response:
Oh ok, definitely - one thing that would help here is the src CLI - it has the ability to edit site global config in fairly nice ways https://github.com/sourcegraph/src-cli/blob/master/cmd/src/config_edit.go
We should extend this for site config - would be pretty easy to do and then you could make programmatic edits fairly easy in this way
Customer context
In the last few days, I've had to guide two customers on how to programmatically set their site config and/or external service configs using the Sourcegraph API. See https://sourcegraph.slack.com/archives/CTJCMDCCS/p1592443054294100?thread_ts=1592413499.290500&cid=CTJCMDCCS, https://sourcegraph.slack.com/archives/CTJCMDCCS/p1593021981314500?thread_ts=1593010018.312200&cid=CTJCMDCCS, and https://sourcegraph.slack.com/archives/CT9P97S6L/p1592935199007600 (https://app.hubspot.com/contacts/2762526/company/1749029033) for relevant discussions with customers.