Connection Profiles
A connection profile enables you to conveniently reuse connection properties with the ol test connection or ol add CLI commands.
Because you can create multiple connection profiles per module, connection profiles are beneficial when your module is tested against different remote data sources. For example, you can define one profile that includes the connection properties for the development environment and another for the production environment.
Create a connection profile
You can create a connection profile in the context of a particular module. In the example below, you create a connection profile called dev.
[module-name]> ol test connection --profile dev --host as400.openlegacy.com --user OPENLEGA1 --password OPENLEGA --code-page 37
[module-name]$ ol test connection --profile dev --host as400.openlegacy.com --user OPENLEGA1 --password OPENLEGA --code-page 37
Apply a connection profile
Instead of specifying the module connection properties, you can only specify the connection profile. In the example below, you apply a connection profile called qa.
[module-name]> ol test connection --profile qa
[module-name]$ ol test connection --profile qa
Set the default connection profile
By default, a module is created with an empty connection profile. Then, it gets automatically updated with connection properties when ol test connection or ol add are executed. The default profile is automatically set with the connection properties passed to ol add in the example below.
temp> ol add --source-path .\itemDetails.cbl --host as400.openlegacy.com --user OPENLEGA1 --password OPENLEGA --code-page 37
temp$ ol add --source-path .\itemDetails.cbl --host as400.openlegacy.com --user OPENLEGA1 --password OPENLEGA --code-page 37
Apply the default connection profile
[module-name]> ol test connection
[module-name]$ ol test connection
After the default profile is set, you can apply it without specifying connection properties at all.
Creating a new profile based on the default profile
If you want to create a new profile with different connection properties than the default profile, only specify new properties or existing properties with different values. The new profile only includes the updated properties and the new properties.
When you use the new profile with ol test connection or ol add, the default profile connection properties that are not included in the new profile will be appended to the new and overridden properties.
[module-name]> ol test connection --password OPENLEGA2 --profile prod
[module-name]$ ol test connection --password OPENLEGA2 --profile prod
Apply a connection on a generated Service
You can apply a specific connection profile to an OpenLegacy-generated services, to do so, you have the following two options:
Option #1
Modify the application YAML as follows:
ol:
flow:
profiles: <OL_ACTIVE_PROFILES>
Option #2
OL_FLOW_PROFILES=<OL_ACTIVE_PROFILES>
Where <OL_ACTIVE_PROFILES>
is a list of comma-separated profiles similar to how you configure profiles for a spring-boot application profiles
Updated 4 months ago