Using the drupal-config commands
You can use the drupal-config commands to list, get the values of, set values, create new, and delete the Drupal configuration objects on your Developer Portal service.
For example, you can use the drupal-config commands to disable CSS and JS aggregation to help with twig debug, see Example.
- Log in as Provider org:
apic login --server management_server --realm provider/identity_provider --username provider_username --password provider_password
You can determine which identity provider to use in the--realm
parameter by entering the following command to see a list of all available identity providers (you do not need to be logged in to use this command):
For example,apic identity-providers:list --scope provider --server mgmt_endpoint_url --fields title,realm
Theapic identity-providers:list --scope provider --server myserver.com --fields title,realm total_results: 2 results: - title: API Manager User Registry realm: provider/default-idp-2 - title: Corporate LDAP user registry realm: provider/corporate-ldap
title
value should enable you to determine which identity provider to use; you can then copy the corresponding--realm
parameter directly from the displayedrealm
value. For any identity providers that were created by your administrator after API Connect was installed, the names will have been determined at creation time. The default API Manager Local User Registry for login as a member of a provider organization isdefault-idp-2
.For full details of the
apic login
command, see Logging in to a management server. - List all of the available Drupal config for a
site.
apic --mode portaladmin drupal-config:list --server management_server --catalog catalogid/name --org orgid/name --format format_type
management_server
is the endpoint URL of the management server (required).catalogid/name
is the ID or name of the catalog that the site belongs to (required).orgid/name
is the ID or name of the provider organization that the catalog belongs to (required).format_type
is the output format. Can bejson
,yaml
,go-template=...
,go-template-file=...
. Defaults toyaml
.
For example:
Note that the example has been reduced as the full response is very large.apic --mode portaladmin drupal-config:list --server my.management.server.com --org ibm --catalog portal-test --format yaml admin_toolbar_tools.settings: name: admin_toolbar_tools.settings adminimal_admin_toolbar.settings: name: adminimal_admin_toolbar.settings advagg.settings: name: advagg.settings advagg_css_minify.settings: name: advagg_css_minify.settings advagg_js_minify.settings: name: advagg_js_minify.settings autologout.settings: name: autologout.settings ...
- List a specific Drupal config for a
site.
apic --mode portaladmin drupal-config:list --server management_server --catalog catalogid/name --org orgid/name --prefix config_prefix --format format_type
config_prefix
is the prefix of the Drupal config, for examplesystem
. If omitted, the command returns all config names in the system.
For example:apic --mode portaladmin drupal-config:list --server my.management.server.com --org ibm --catalog portal-test --format yaml --prefix system.theme system.theme: name: system.theme system.theme.global: name: system.theme.global
- Update a Drupal config key
value.
apic --mode portaladmin drupal-config:set -server management_server --catalog catalogid/name --org orgid/name --config_name config_name --config_key config_key --config_value config_value
config_name
is the name of the Drupal config object, for examplesystem.site
(required).config_key
is the Drupal config key, for examplepage.front
(required).config_value
is the value to assign to the config key (required).
For example, to set the default theme toclaro
:apic --mode portaladmin drupal-config:set --server my.management.server.com --org ibm --catalog portal-test --config_name system.theme --config_key default --config_value claro // Do you want to update default key in system.theme config?: yes.
- Create a new Drupal config key and set the
value.
apic --mode portaladmin drupal-config:set -server management_server --catalog catalogid/name --org orgid/name --config_name config_name --config_key new_config_key --config_value new_config_value
For example, to create a new config key and set the value in thesystem.site
config object:apic --mode portaladmin drupal-config:set --server my.management.server.com --org ibm --catalog portal-test --config_name system.site --config_key new_key --config_value new_value // new_key key does not exist in system.site config. Do you want to create a new config key?: yes.
- Get all of the key values for a Drupal config
object.
apic --mode portaladmin drupal-config:get --server management_server --catalog catalogid/name --org orgid/name --format format_type --config_name config_name
For example, to find out what themes are available:apic --mode portaladmin drupal-config:get --server my.management.server.com --org ibm --catalog portal-test --format json --config_name system.theme { "admin": "seven", "default": "claro", "_core": { "default_config_hash": "fOjer9hADYYnbCJVZMFZIIM1azTFWyg84ZkFDHfAbUg" }, "defaultplus": "bartisk" }
- Get the value of a specific key for a Drupal config
object.
apic --mode portaladmin drupal-config:get --server management_server --catalog catalogid/name --org orgid/name --format format_type --config_name config_name --config_key config_key
For example, to find out what the default theme is:apic --mode portaladmin drupal-config:get --server my.management.server.com --org ibm --catalog portal-test --format json --config_name system.theme --config_key default { "system.theme:default": "claro" }
- Delete a Drupal config object, or a specific config key and its
value.
apic --mode portaladmin drupal-config:delete --server management_server --catalog catalogid/name --org orgid/name --config_name config_name --config_key config_key
config_key
is the Drupal config key, for examplepage.front
(optional).
For example, to delete the config keynew_key
and its value:apic --mode portaladmin drupal-config:delete --server my.management.server.com --org ibm --catalog portal-test --config_name system.site --config_key new_key The config object/value was successfully deleted.
Example
The following scenario gives an example of how to turn off CSS and JS aggregation to help with twig debug. However, on a production system aggregation should be enabled for performance reasons.
- Check the settings for performance, which include settings for CSS and JS
aggregation:
apic --mode portaladmin drupal-config:get --server management_server --catalog catalogid/name --org orgid/name --config_name system.performance
- Turn off CSS
aggregation:
apic --mode portaladmin drupal-config:set --server management_server --catalog catalogid/name --org orgid/name --config_name system.performance --config_key css.preprocess --config_value 0
- Turn off JS
aggregation:
apic --mode portaladmin drupal-config:set --server management_server --catalog catalogid/name --org orgid/name --config_name system.performance --config_key js.preprocess --config_value 0
- Then, rebuild the
cache:
apic --mode portaladmin site:cache-rebuild --server management_server --catalog catalogid/name --org orgid/name
Note:
- Disabling aggregation affects site performance, so if the site goes into production remember to turn aggregation back on again.
- Although the settings are shown as
true
orfalse
, to set them by using thedrupal-config:set
command, you must apply a value of1
fortrue
, and0
forfalse
.