@@ -36,16 +36,17 @@ var (
3636// This defines both the auth for talking to the API, as well as
3737// where to put problems that get downloaded.
3838type Config struct {
39- APIKey string `json:"apiKey"`
40- Dir string `json:"dir"`
41- API string `json:"api"`
42- ProblemsHost string `json:"problemsHost "`
43- home string // cache user's home directory
44- file string // full path to config file
39+ APIKey string `json:"apiKey"`
40+ Dir string `json:"dir"`
41+ API string `json:"api"`
42+ XAPI string `json:"xapi "`
43+ home string // cache user's home directory
44+ file string // full path to config file
4545
4646 // deprecated, get rid of them when nobody uses 1.7.0 anymore
4747 ExercismDirectory string `json:"exercismDirectory,omitempty"`
4848 Hostname string `json:"hostname,omitempty"`
49+ ProblemsHost string `json:"problemsHost,omitempty"`
4950}
5051
5152// Home returns the user's canonical home directory.
@@ -139,6 +140,7 @@ func (c *Config) Write() error {
139140 renameLegacy ()
140141 c .ExercismDirectory = ""
141142 c .Hostname = ""
143+ c .ProblemsHost = ""
142144
143145 // truncates existing file if it exists
144146 f , err := os .Create (c .file )
@@ -162,8 +164,12 @@ func (c *Config) configure() (*Config, error) {
162164 c .API = hostAPI
163165 }
164166
165- if c .ProblemsHost == "" {
166- c .ProblemsHost = hostXAPI
167+ if c .ProblemsHost != "" {
168+ c .XAPI = c .ProblemsHost
169+ }
170+
171+ if c .XAPI == "" {
172+ c .XAPI = hostXAPI
167173 }
168174
169175 dir , err := c .homeDir ()
@@ -217,6 +223,7 @@ func (c *Config) sanitize() {
217223 c .APIKey = strings .TrimSpace (c .APIKey )
218224 c .Dir = strings .TrimSpace (c .Dir )
219225 c .API = strings .TrimSpace (c .API )
226+ c .XAPI = strings .TrimSpace (c .XAPI )
220227 c .Hostname = strings .TrimSpace (c .Hostname )
221228 c .ProblemsHost = strings .TrimSpace (c .ProblemsHost )
222229}
0 commit comments