Page MenuHomePhabricator

Alert user to create local config file if non-existent
Closed, ResolvedPublic

Description

Description
Currently, we are loading the local config in the mediawiki-tools-api-testing repo from /configs/default.json. A better approach to this would be to un-track the file in gerrit, and have a user create their own local config file, using a config template as their base example.

Requirements

  • Create a template config file /configs/example.json that conforms to current configs/local.json file
  • Throw an error and instruct user to create ./local.json if user runs tests and does not have a ./local.json file
  • Modify existing Config.js integration tests for these changes
  • Modify existing documentation on local config setup

Event Timeline

nnikkhoui updated the task description. (Show Details)
nnikkhoui updated the task description. (Show Details)
nnikkhoui updated the task description. (Show Details)

@Pchelolo @Clarakosi

Is the 'configs/' directory meant to be strictly for production config files or you mind if the local.json config file goes in there too? (as opposed to just putting the local.json in the top level directory.)

I don't think it matters much to be honest... Whatever you think is better, or whatever @Clarakosi thinks is better.

ok cool - It looks like @holger.knust was the one who originally wrote config logic so i will keep it top level as he originally had it!

@nnikkhoui Other files can go in the configs directory including the local.json file. From the docs:

The configuration file is evaluated in the following order:

1) `API_TESTING_CONFIG_FILE` if set
2) `local.json` if it exists
3) `configs/local.json`  if it exists
4) `configs/default.json`

I don't remember why configs/default.json made that list but because it is there I find myself just adding the key there. A better approach, as you mentioned above, maybe just renaming default.json to example.json so users are forced to create a local.json file that is already untracked.

Change 547321 had a related patch set uploaded (by Nikki Nikkhoui; owner: Nikki Nikkhoui):
[mediawiki/tools/api-testing@master] Alert user to create local config file if non-existent

https://gerrit.wikimedia.org/r/547321

Change 547321 merged by jenkins-bot:
[mediawiki/tools/api-testing@master] Alert user to create local config file if non-existent

https://gerrit.wikimedia.org/r/547321