Global Settings - Xiphe/WP-Project-Update-API GitHub Wiki

The following keys can be set in the globalSettings.json file.

baseUrl

Required
Default: "baseUrl" : "[http://plugins.example.org/api/]"
Value: string
This should be an url pointing to the index.php file of this project on your server.
Used by the basic_check and plugin_information requests to build the project_details and download_latest request urls.

useCache

Required
Default: "useCache" : true
Value: bool
Bool value to enable or disable caching of the project data on the api server. true will reduce the response time because lesser cURL requests have to be sendet to the remote host. This has to be true for the renameFolders option. If you want to use gitlab as a remote host you have to set this option to true because by default gilab serves tar.gz files for archives. When cache is enabled they are converted into zip files.

renameFolders

Optional
Default: "renameFolders" : true
Value: bool
By default github and bitbucket are naming the project folders containing a part of the commit sha and the username. This comes unhandy because your project will have a different foldername in the wp-content folder each time you update. Gitlab even does not wrap the project files in a folder. To prevent this you can turn this setting to true and the project folders will be renamed by the request slug (see API Requests) or the "folderName"-string served by the project settings. This requires the global "useCache" setting to be true.

urls

Required
Default:

{
	"urls" : {  
		"github" : {  
			"files" : "https://raw.github.com/:projectOwner/:slug/:branch/:filepath",  
			"archive" : "https://nodeload.github.com/:projectOwner/:slug/zipball/:branch",  
			"commits" : "https://api.github.com/repos/:projectOwner/:slug/commits?per_page=1&sha=:branch"  
		},  
		"bitbucket" : {  
			"files" : "https://api.bitbucket.org/1.0/repositories/:projectOwner/:slug/raw/:branch/:filepath",  
			"archive" : "https://bitbucket.org/:projectOwner/:slug/get/:branch.zip",  
			"commits" : "https://api.bitbucket.org/1.0/repositories/:projectOwner/:slug/changesets/:branch?limit=1"  
		},  
		"[yourGitlabKey]" : {  
			"files" : "http://[gitlab.example.org]/:slug/:branch/blob?path=:filepath",  
			"archive" : "http://[gitlab.example.org]/:slug/repository/archive?ref=:branch",  
			"commits" : "http://[gitlab.example.org]/api/v2/projects/:slug/repository/branches?private_token=:token"  
		}  
	}
}

Value: object
The default urls for the 3 types of requests the api will sent to the remote hosts.
They can contain the placeholders: ":projectOwner", ":slug", ":branch", ":filepath" and ":token".

You should not have to change the github and bitbucket urls.

gitlab tested with 2.7.0 If you want to use gitlab as a remote host you will have to change "[yourGitlabKey]" into a key that you use in the project settings for your gitlab project. And replace [gitlab.example.org] in the urls with the url to your gitlab installation.

users

Optional
Default:

{
	"users" : {
		"bitbucket" : {  
			"[bitbucket Read-Users login name]" : "[bitbucket Read-Users password]"  
		},  
		"[yourGitlabKey]" : {  
			"[your Gitlab Read-Users email address]" : {  
				"pass" : "[your Gitlab Read-Users password]",  
				"token" : "[your Gitlab Read-Users private token]"  
			}  
		}  
	}
}

Value: object
Globaly served userdata. This enables you to just set the host and user in the project settings file so you can change the passwords globaly.

If you want to use gitlab you should change "[yourGitlabKey]" into the same string that you used for the urls.