Managing Environment Configurations as Code
Inconsistent settings across environments are a common source of subtle bugs and deployment failures. When configurations are managed manually through admin UIs, teams lose visibility into changes, which makes audits and rollbacks difficult. By managing configurations as code, you can apply version control, peer review, and automated deployment to your settings. Liferay configuration client extensions empower this approach by treating environment settings as reusable, version-controlled assets.
In this lesson, you'll learn how configuration client extensions work and how OAuth 2.0 can secure the API calls your extensions depend on.
Understanding Configuration Client Extensions
Configuration client extensions offer a streamlined approach to managing and deploying Liferay configurations. This general category divides into three types, each set in the client-extension.yaml:
| Name | Type | Description |
|---|---|---|
| Instance Settings | type: instanceSettings |
Configure a wide variety of Liferay settings referenced by each configuration’s PID (Persistent IDentity). |
| OAuth Headless Server | type: oAuthApplicationHeadlessServer |
Pre-configure a Liferay OAuth2 application with a Headless Server client profile, required for API calls that aren't authorized by a specific user. |
| OAuth User Agent | type: oAuthApplicationUserAgent |
Pre-configure a Liferay OAuth2 application with a User Agent Application client profile, required for API calls authorized by a specific user. |
You can group all configuration client extensions with any of the other three general categories of client extensions: batch, frontend, and microservice. This provides flexibility for organizing your code and allocating system resources effectively.
When working with configuration client extensions:
-
Analyze the client-extension.yaml for misconfigured syntax if its deployment fails.
-
Deploy using up-to-date, compatible versions of Gradle and Java.
OAuth Client Extensions
OAuth 2.0 authorizes password-less access to resources, encrypting all authorization transport through HTTPS. Implementing OAuth 2.0 authentication profiles as configuration client extensions enables other client extensions that rely on specific authentication methods. This ensures your environments align with your organization's security and integration requirements.
Both OAuth headless server and OAuth headless user agent client extensions depend on metadata that Liferay provides as a route (see Context-Sensitive Information). Any executable workload deployed with this client extension must wait for this route before it runs.
In the previous exercise, you created an OAuth headless server client extension to authorize API calls with the necessary scopes for Clarity's batch client extension. This route secures data passed between systems and ensures it can't be intercepted.
Instance Settings Client Extensions
Instance settings configure a wide variety of Liferay properties that apply to an individual virtual instance. This empowers you to use different configurations for individual instances in the same Liferay environment. You can use instance settings client extensions to override system settings and to configure settings only available at the instance level.
In instance settings client extensions, each configuration is referenced by its PID (Persistent IDentity). See YAML Properties for client extension configurations specific to instance settings client extensions.
Valid values for properties depend on the specific Java class being used and its data type, such as int, boolean, or String. For example, a class representing glasses might have properties of type int to store the quantity of glasses, boolean to indicate whether the glasses have a prescription, and String for the model name. See Scalar Properties for available data types.
Benefits of Managing Environment Configurations as Code
Configuration client extensions provide these benefits:
- Centralized Collaboration: With client extensions checked into source control, teams can collaborate seamlessly and guarantee identical settings and properties.
- Faster Deployment: Streamline the setup of new environments and accelerate the implementation of configuration changes.
- Improved Visibility: Consolidating portal configurations within a client extensions project simplifies configuration management with a single, accessible point of reference for understanding how critical properties are set.
- Increased Consistency: Maintaining a common configuration baseline empowers all environments to operate with consistent properties, preventing wasted time due to settings mismatches between environments.
- Improved Security and Compliance: Support strong security practices by enabling audit trails and change management records for all configuration deployments.
Conclusion
A configuration as code approach treats Liferay's environment settings as reusable, version-controlled assets. Configuration client extensions automate configuration management and reduce the risks associated with manual intervention. The improved reliability, faster deployment, and visibility reduce manual workload and empower you to achieve consistent, predictable results.
Next, you'll review what you've learned before moving on to the next module.
Capabilities
Product
Education
Knowledge Base
Contact Us