Configuration
Configure module settings, dependencies, and runtime overrides
Module Settings
function configure() {
settings = {
apiKey: "",
timeout: 30,
debug: false,
endpoints: {
primary: "https://api.example.com/v1",
fallback: "https://api.example.com/v2"
}
};
}@Override
public void configure( IBoxContext context, ModuleRecord record ) {
record.settings.put( Key.of( "apiKey" ), "" );
record.settings.put( Key.of( "timeout" ), 30 );
record.settings.put( Key.of( "debug" ), false );
IStruct endpoints = new Struct();
endpoints.put( Key.of( "primary" ), "https://api.example.com/v1" );
endpoints.put( Key.of( "fallback" ), "https://api.example.com/v2" );
record.settings.put( Key.of( "endpoints" ), endpoints );
}Runtime Overrides
{
"modules": {
"myModule": {
"enabled": true,
"settings": {
"apiKey": "sk-abc123",
"debug": true
}
}
}
}Merge Behavior
configure() setting
boxlang.json override
Effective value
Disabling Modules
Accessing Settings
Dependencies
Inter-Module Communication
Next Steps
Last updated
Was this helpful?
