Can I change a value in sonar.properties via API?

sonarqube

(Jonathan Velasco) #1

Hello everyone,

I need to know if is posibly to change sonar.properties file via API, because im using Sonarqube with Keycloak and protocol SAML, so I need to change cert or other parameters when I will need it and made manual with multi sonar server is so tedious, es better with automation and one idea is using API

I loooking fro in doc but I dont see nothing about that
https://docs.sonarqube.org/display/DEV/Web+API

Regards


SAML authentication plugin automatic install
(Colin Mueller) #2

Check out the Web API documentation linked in the footer of your instance (hint: api/settings!)


(Jonathan Velasco) #4

Hello @ColinHMueller,

Ty for reply, I am wachting api and see values of SAML plugins in sonar.properties are read-only? So if hace value I cant change then ? How about this discription: api-setting-set

The only way is that values are blank? :frowning:

Regards


(Colin Mueller) #5

@Jonathan_Velasco At least for SonarSource’s [SAML Authentication Plugin|https://docs.sonarqube.org/display/PLUG/SAML+Authentication+Plugin], those related settings are set through the UI (thus also able to be manipulated with the Web API). They aren’t set in a sonar.properties file. I can’t speak for other plugins.


(G Ann Campbell) #6

Hi,

Colin answered the question in the body of the OP. For the sake of posterity, I’d like to answer the question in the title.

No, you cannot reset, override, &etc values set in sonar.properties via the UI / web services. Conversely, you cannot set in sonar.properties values that are set via the UI / web services.

…and never the twain shall meet.

 
Ann


(Jonathan Velasco) #7

Hello @ganncamp ,

I have one more question, but is posible set values if the key of properties is empty?

For example, I want set this keys of plugin SAML in sonar.properties

sonar.auth.saml.enabled= (to true)
sonar.auth.saml.certificate.secured= (cert here)

Is posible with API set this values?

Regards


(G Ann Campbell) #8

Hi,

Yes, it should be. Look at /api/settings/set.

 
Ann