Create or update repository with API, disable Strict Content Type Validation - Sonatype Nexus Repository / Best Practices - Sonatype Community
Create or update repository with API, disable Strict Content Type Validation
post by pogacnik on Apr 25, 2023
Hello, I would like to change some repository settings with scripts.
By default there are some settings which I would like to edit, for example: “Strict Content Type Validation” is enabled, “Maximum component age”, “Maximum metadata age”,…
Currently I am using this scripts to create repository:
curl -u admin:pass -X POST --header ‘Content-Type: application/json’ -d @/tmp/addRepos.json http://127.0.0.1:8081/service/rest/v1/script
curl -u admin:pass -X POST --header ‘Content-Type: text/plain’ http://127.0.0.1:8081/service/rest/v1/script/addRepos/run
cat /tmp/addRepos.json
{
“name”: “addRepos”,
“content”: " repository.createRawProxy(‘raw-proxy’, ‘ https://nexus/repository/raw-proxy/’);",
“type”: “groovy”
}
“repository.createRawProxy” Does not support adding other parameters like “strictContentTypeValidation=false” or “contentMaxAge=1440.0, metadataMaxAge=1440.0”.
Is there some other way to add repo and specify those parameters or additionally change them?
post by pogacnik on May 29, 2023
My solution is to create repo and then update it with API scripts.