This article describes how to add custom profiles. By default, the LuciadFusion Platform comes with a number of pre-defined profiles:

  • A development profile, meant for development.

  • A production profile, meant for deployment.

You can consult Configuring LuciadFusion Studio for more information on profiles.

It can be useful to create additional profiles, for example, for a staging and testing environment. The samples.fusion.platform.profiles shows how to do this, and how to make sure that the application finds them. The following steps are required to create additional profiles:

  1. Add a new YAML file for each profile. Typically, one profile is used for each environment, for example for development, testing, staging, or production. The name of each YAML files should follow the following convention: application-<profile name>.yml, for example application-staging.yml or application-test.yml. When you name the profiles like that, the Spring framework automatically maps the staging and test profile names to the corresponding YAML files. We recommend structuring the contents of the YML files similarly to the YAML files shipped with LuciadFusion. This means that you import the fusion.common.yml configuration file to include properties that are shared between all profiles/configurations, and that you only add profile-specific properties to the new YAML files. See Program: Example of a custom profile for an example of a custom YAML file.

  2. Make sure that the application can find the new profiles. By default, the Spring framework searches on the classpath root or a /config/ subdirectory on the classpath. If your custom profile is located somewhere else, you can express this through the Spring property: spring.config.additional-location. You can add a VM property, for example. See Program: A VM property that adds an additional profile location.

  3. Specify which profile to use when the application is running or being deployed. The sample for example uses the fusion.single profile combined with the staging profile. See Configuring LuciadFusion Studio to find out how to specify the used profiles. You can add a VM property, for example. See Program: A VM property that activates the custom profile.

Program: Example of a custom profile
###################
# Shared settings #
###################

# Includes all configuration properties that are shared between all used configuration files. Make
# sure not to duplicate any properties from the fusion.common.yml configuration in this file to
# change them, but modify them in the fusion.common.yml configuration file.

spring.config.import: classpath:fusion.common.yml

##################
# Other settings #
##################

# Run the application on port 8010
server.port: 8010

# ...
# See deployment guide to see a list of optional and required properties
Program: A VM property that adds an additional profile location
-Dspring.config.additional-location=classpath:/samples/fusion/profiles/
Program: A VM property that activates the custom profile
-Dspring.profiles.active=fusion.single,staging