Skip to content

Martini Package Properties

In addition to global application properties, Martini supports properties that are localized to specific packages. These package-specific properties function similarly to Martini's global properties but have a narrower scope confined to individual packages.

Package Properties contain variables that are specific to the application, such as API keys or the path to endpoints like server URLs. They are user-defined variables that can be referenced in your Services and Workflows.

Creating Package Properties

The Package properties file is not automatically generated when you create a package. If the .properties file is missing, you can create them under the conf/properties folder.

Using Martini Designer:

  • Expand the path <package-name>/configuration/properties in the Navigator.
  • Create a new folder by right-clicking the configuration folder and selecting New | Directory. Name the folder properties.
  • Right-click the newly created properties folder and selecting New | File. Name the file package.properties.

The package.properties file can also be automatically generated when a package property is saved through a function or one-liner command in Martini Designer:

1
io.toro.martini.PackageMethods.savePackageProperty(String key, String value)

Editing Package Properties

Locate your Package Properties in the Martini Designer:

  • Expand the path <package-name>/configuration/properties in the Navigator.
  • Double click on the file to create or edit properties that relate to your Package.
  • Click the Save icon in the top toolbar to save any changes.

The same file can be found on the file system of Martini Server Runtime in the location:

1
2
3
4
5
6
<martini-home>
└── packages
    └── <package-name>
        └── conf
            └── properties
                └── package.properties

Configuring Environment Specific Package Properties

Whilst Package Properties contain variables that are specific to the Package itself, these properties will often vary depending on the environment. For example, if a Package Property contains an API key then that value may be different in development environment to a production environment.

Package Properties can be customized for each environment by setting a prefix that will be used by the target environment.

Environment-specific Package Properties

All files following the <prefix>.package.properties format are visible in Martini Designer. By default, if you modify or add configurations in the main package.properties file, Martini will automatically save those changes to the environment-specific file set in the environment prefix (e.g., staging.package.properties). This ensures that environment-specific properties are seamlessly applied without requiring manual updates in each environment file.

Step 1: Setting an Environment Prefix

Open the override properties file located at:

1
2
3
4
<martini-home>
└── conf
    └── overrides
        └── override.properties

Set a name for the environment using the following property:

package.properties.prefix=<environment>

Examples:

You may set any value you like as the prefix, here are a few examples:

package.properties.prefix=dev may indicate a development environment package.properties.prefix=stage may indicate a staging environment package.properties.prefix=production may indicate a production environment

Step 2: Create a Package Properties File for Each Environment

Locate your Package Properties in the Martini Designer:

  • Expand the path <package-name>/configuration/properties in the Navigator.
  • Create a new file by right-clicking the properties folder and selecting New | File. Name the file <environment>.package.properties.

For example, if you set the environment prefix in Step 1 to stage, your package properties file should be named stage.package.properties.

Now, when the application property package.properties.prefix is set to stage, the associated file from the Package Properties will be used.

Note that the default package.properties file will be used if no environment prefix is set in Step 1.