Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composable startup configuration with extra bindings #2578

Open
tomakehurst opened this issue Jan 16, 2024 · 1 comment
Open

Composable startup configuration with extra bindings #2578

tomakehurst opened this issue Jan 16, 2024 · 1 comment

Comments

@tomakehurst
Copy link
Member

Proposal

Overview

To provide more flexibility around how WireMock is configured at startup.

Refactor the hierarchy under Options, creating a composite class with hierarchical delegation and a set of new bindings for properties files, environment variables and system properties.

This should support construction of cases like this:

new WireMockServer(CompositeConfiguration
                .add(new CommandLineOptions())
                .add(new EnvironmentConfig())
                .add(wireMockConfig().dynamicPort())
                .build()
        );

Where the CLI options will take the highest precedence and the programmatically constructed config the lowest.

It should also be possible to provide a default configuration via a template method in WireMockServerRunner so that different (or end-user custom) builds of WireMock can provide different defaults.

Implementation

Ideally we would create an abstract base class for all of the config binding impls, which would define all of the keys in a similar manner as CommandLineOptions currently does, but sufficiently abstractly that it could be used for env vars, CLI, system props etc.

The main challenge here might be figuring out way to describe, parse and validate these in a way that's not specific to CLI, although it might be possible to wrap the current joptsimple based solution.

References

No response

@tomakehurst
Copy link
Member Author

@dirkbolte as we discussed last week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant