Chapter 2. Using the configuration API
The configuration tool exposes 4 endpoints that can be used to build, validate, bundle and deploy a configuration. The config-tool API is documented at https://github.com/quay/config-tool/blob/master/pkg/lib/editor/API.md. In this section, you will see how to use the API to retrieve the current configuration and how to validate any changes you make.
2.1. Retrieving the default configuration Copy linkLink copied to clipboard!
If you are running the configuration tool for the first time, and do not have an existing configuration, you can retrieve the default configuration. Start the container in config mode:
sudo podman run --rm -it --name quay_config \ -p 8080:8080 \ registry.redhat.io/quay/quay-rhel8:v3.15.1 config secret
$ sudo podman run --rm -it --name quay_config \
-p 8080:8080 \
registry.redhat.io/quay/quay-rhel8:v3.15.1 config secret
Use the config
endpoint of the configuration API to get the default:
curl -X GET -u quayconfig:secret http://quay-server:8080/api/v1/config | jq
$ curl -X GET -u quayconfig:secret http://quay-server:8080/api/v1/config | jq
The value returned is the default configuration in JSON format:
2.2. Retrieving the current configuration Copy linkLink copied to clipboard!
If you have already configured and deployed the Quay registry, stop the container and restart it in configuration mode, loading the existing configuration as a volume:
sudo podman run --rm -it --name quay_config \ -p 8080:8080 \ -v $QUAY/config:/conf/stack:Z \ registry.redhat.io/quay/quay-rhel8:v3.15.1 config secret
$ sudo podman run --rm -it --name quay_config \
-p 8080:8080 \
-v $QUAY/config:/conf/stack:Z \
registry.redhat.io/quay/quay-rhel8:v3.15.1 config secret
Use the config
endpoint of the API to get the current configuration:
curl -X GET -u quayconfig:secret http://quay-server:8080/api/v1/config | jq
$ curl -X GET -u quayconfig:secret http://quay-server:8080/api/v1/config | jq
The value returned is the current configuration in JSON format, including database and Redis configuration data:
2.3. Validating configuration using the API Copy linkLink copied to clipboard!
You can validate a configuration by posting it to the config/validate
endpoint:
The returned value is an array containing the errors found in the configuration. If the configuration is valid, an empty array []
is returned.
2.4. Determining the required fields Copy linkLink copied to clipboard!
You can determine the required fields by posting an empty configuration structure to the config/validate
endpoint:
The value returned is an array indicating which fields are required: