How to configure properties for Github Auth plugin through code/API

Hi all,

We are using SonarQube Community Edition version 7.6
We have installed Github Authentication plugin version - 1.5.0.870 and placed it into $SONARQUBE_HOME/extensions/plugins/

This documentation (https://docs.sonarqube.org/display/PLUG/GitHub+Authentication+Plugin) tells us how to configure the properties via SonarQube UI.

By plugin properties, we mean
sonar.auth.github.enabled,
sonar.auth.github.clientId.secured
sonar.auth.github.loginStrategy etc.

We have tried updating the plugin properties by adding them to $SONARQUBE_HOME/conf/sonar.properties file, however, none of the properties get updated. We want to maintain all the infrastructure we’re building, as code, and version control it. What’s the best way to do that?

We have also checked some available APIs for plugins. But, they only allow us to install, uninstall, update etc, but do not allow us to configure the plugin properties on SonarQube. Is there a way we could configure them through API, if not for properties file?

Cheers
Archana/Kelsey

Hi,

It’s not possible to configure server settings in sonar.properties. You need to use api/settings/set after the server is started if you want to configure the settings by a script or something like that.

Regards,
Julien Lancelot

Hi Julien,

Thank you for the prompt response. That helps. I have checked out the api/settings/set API as mentioned above. However, it looks like we can only set one key at a time. Is there a way we could set multiple keys with a single API call?

Example: Currently, this is what I can do:
curl -X POST -u username:password 'https://mydomain.com/api/settings/set?key=sonar.forceAuthentication&value=true'
Can I set multiple such key-value pairs through a single call?

Cheers,
Archana

No it’s only possible to set one setting at a time.

Okay, thanks for letting us know, Julien. Is there a plan to support multiple keys in the future?

Not for the moment sorry.

Okay. Thanks for letting us know.