Profiles

KissConfig supports one active profile in v0.1.0.

AppConfig config = KissConfig.builder()
        .profile("prod")
        .mapTo(AppConfig.class);

Profiles are never enabled automatically. SearchOrder.production() does not imply profile("prod"); it only changes source read order.

Validation

Profile names must match:

[a-zA-Z0-9_-]+

Rejected examples:

Invalid profiles throw ConfigInvalidProfileException before loading starts.

Property File Expansion

With .propertyFile("application.properties") and .profile("prod"), directory and classpath locations attempt:

application.properties
application-prod.properties

With myapp.properties:

myapp.properties
myapp-prod.properties

Env File Expansion

Env files are still opt-in.

With .envFile(".env") and .profile("prod"), directory locations attempt:

.env
.env.prod

With myapp.env:

myapp.env
myapp-prod.env

Production Example

Given:

KissConfig.builder()
        .propertyFile("application.properties")
        .envFile(".env")
        .profile("prod")
        .searchOrder(SearchOrder.of(ConfigLocation.path("/opt/app")));

The resolver attempts:

/opt/app/application.properties
/opt/app/application-prod.properties
/opt/app/.env
/opt/app/.env.prod

Because default MergeStrategy.FILL_MISSING_ONLY is used:

If profile or env files should override base values, configure:

.mergeStrategy(MergeStrategy.OVERRIDE_EXISTING)

SearchOrder.production()

SearchOrder.production() is an external-first read order. It does not:

Configure those choices explicitly.