@@ -11,7 +11,7 @@ var configCommands commander
1111func  init () {
1212	usage  :=  `'src config' is a tool that manages global, organization, and user settings on a Sourcegraph instance. 
1313
14- The effective configuration  is computed by shallow-merging the following settings, in order from lowest to highest precedence: 
14+ The effective setting  is computed by shallow-merging the following settings, in order from lowest to highest precedence: 
1515
1616- Global settings (site-wide) 
1717- Organization settings for the user's organizations (if any) 
2626
2727The commands are: 
2828
29- 	get       gets the effective (merged) configuration  
30- 	edit      updates configuration  settings 
31- 	list      lists the partial settings (that, when merged, yield the effective configuration ) 
29+ 	get       gets the effective (merged) settings  
30+ 	edit      updates settings 
31+ 	list      lists the partial settings (that, when merged, yield the effective settings ) 
3232
3333Use "src config [command] -h" for more information about a command. 
3434` 
@@ -49,14 +49,12 @@ Use "src config [command] -h" for more information about a command.
4949	})
5050}
5151
52- const  configurationSubjectFragment  =  ` 
53- fragment ConfigurationSubjectFields  on ConfigurationSubject  { 
52+ const  settingsSubjectFragment  =  ` 
53+ fragment SettingsSubjectFields  on SettingsSubject  { 
5454    id 
5555    latestSettings { 
5656        id 
57-         configuration { 
58-             ...ConfigurationFields 
59-         } 
57+         contents 
6058        author { 
6159            ...UserFields 
6260        } 
@@ -67,60 +65,48 @@ fragment ConfigurationSubjectFields on ConfigurationSubject {
6765} 
6866` 
6967
70- type  ConfigurationSubject  struct  {
71- 	ID                     string 
72- 	LatestSettings         * Settings 
73- 	SettingsURL            string 
74- 	ViewerCanAdminister    bool 
75- 	ConfigurationCascade   ConfigurationCascade 
68+ type  SettingsSubject  struct  {
69+ 	ID                   string 
70+ 	LatestSettings       * Settings 
71+ 	SettingsURL          string 
72+ 	ViewerCanAdminister  bool 
73+ 	SettingsCascade       SettingsCascade 
7674}
7775
7876type  Settings  struct  {
79- 	ID              int32 
80- 	Configuration   Configuration 
81- 	Author          * User 
82- 	CreatedAt       string 
77+ 	ID         int32 
78+ 	Contents    string 
79+ 	Author     * User 
80+ 	CreatedAt  string 
8381}
8482
85- const  configurationCascadeFragment  =  ` 
86- fragment ConfigurationCascadeFields  on ConfigurationCascade  { 
83+ const  settingsCascadeFragment  =  ` 
84+ fragment SettingsCascadeFields  on SettingsCascade  { 
8785    subjects { 
88-         ...ConfigurationSubjectFields 
89-     } 
90-     merged { 
91-         ...ConfigurationFields 
86+         ...SettingsSubjectFields 
9287    } 
88+     final 
9389} 
9490` 
9591
96- type  ConfigurationCascade  struct  {
97- 	Subjects  []ConfigurationSubject 
98- 	Merged    Configuration 
99- }
100- 
101- const  configurationFragment  =  ` 
102- fragment ConfigurationFields on Configuration { 
103-     contents 
104- } 
105- ` 
106- 
107- type  Configuration  struct  {
108- 	Contents  string 
92+ type  SettingsCascade  struct  {
93+ 	Subjects  []SettingsSubject 
94+ 	Final     string 
10995}
11096
111- const  viewerConfigurationQuery  =  `query ViewerConfiguration  { 
112-   viewerConfiguration  { 
113-     ...ConfigurationCascadeFields  
97+ const  viewerSettingsQuery  =  `query ViewerSettings  { 
98+   viewerSettings  { 
99+     ...SettingsCascadeFields  
114100  } 
115- }`  +  configurationCascadeFragment  +  configurationSubjectFragment   +   configurationFragment  +  userFragment 
101+ }`  +  settingsCascadeFragment  +  settingsSubjectFragment  +  userFragment 
116102
117- const  configurationSubjectCascadeQuery  =  `query ConfigurationSubjectCascade ($subject: ID!) { 
118-   configurationSubject (id: $subject) { 
119-     configurationCascade  { 
120-       ...ConfigurationCascadeFields  
103+ const  settingsSubjectCascadeQuery  =  `query SettingsSubjectCascade ($subject: ID!) { 
104+   settingsSubject (id: $subject) { 
105+     settingsCascade  { 
106+       ...SettingsCascadeFields  
121107    } 
122108  } 
123- }`  +  configurationCascadeFragment  +  configurationSubjectFragment   +   configurationFragment  +  userFragment 
109+ }`  +  settingsCascadeFragment  +  settingsSubjectFragment  +  userFragment 
124110
125111type  KeyPath  struct  {
126112	Property  string  `json:"property,omitempty"` 
@@ -150,18 +136,18 @@ query ViewerUserID {
150136	return  result .CurrentUser .ID , nil 
151137}
152138
153- func  getConfigurationSubjectLatestSettingsID (subjectID  string ) (* int , error ) {
139+ func  getSettingsSubjectLatestSettingsID (subjectID  string ) (* int , error ) {
154140	var  result  struct  {
155- 		ConfigurationSubject  * struct  {
141+ 		SettingsSubject  * struct  {
156142			LatestSettings  * struct  {
157143				ID  int 
158144			}
159145		}
160146	}
161147	req  :=  & apiRequest {
162148		query : ` 
163- query ConfigurationSubjectLatestSettingsID ($subject: ID!) { 
164-   configurationSubject (id: $subject) { 
149+ query SettingsSubjectLatestSettingsID ($subject: ID!) { 
150+   settingsSubject (id: $subject) { 
165151    latestSettings { 
166152      id 
167153    } 
@@ -174,11 +160,11 @@ query ConfigurationSubjectLatestSettingsID($subject: ID!) {
174160	if  err  :=  req .do (); err  !=  nil  {
175161		return  nil , err 
176162	}
177- 	if  result .ConfigurationSubject  ==  nil  {
178- 		return  nil , fmt .Errorf ("unable to find configuration  subject with ID %s" , subjectID )
163+ 	if  result .SettingsSubject  ==  nil  {
164+ 		return  nil , fmt .Errorf ("unable to find settings  subject with ID %s" , subjectID )
179165	}
180- 	if  result .ConfigurationSubject .LatestSettings  ==  nil  {
166+ 	if  result .SettingsSubject .LatestSettings  ==  nil  {
181167		return  nil , nil 
182168	}
183- 	return  & result .ConfigurationSubject .LatestSettings .ID , nil 
169+ 	return  & result .SettingsSubject .LatestSettings .ID , nil 
184170}
0 commit comments