Use the
@application-engineering-on-call
handle on Slack for help.
Provides information to other libraries in which environment they are running in.
Allows to set default properties for specific environments.
Typical use case is for various Wise libraries to set environment specific default properties in their EnvironmentPostProcessor
implementations.
WiseEnvironment.setDefaultProperty("my-library", WiseEnvironment.PRODUCTION, "tw-reliable-jdbc.sslMode", SslMode.VERIFY_FULL);
WiseEnvironment.setDefaultProperty("my-library", WiseEnvironment.STAGING, "tw-reliable-jdbc.sslMode", SslMode.PREFERRED);
WiseEnvironment.setDefaultProperty("my-library", WiseEnvironment.CUSTOM_ENVIRONMENT, "tw-reliable-jdbc.sslMode", SslMode.VERIFY_CA);
See WiseEnvironment
class for other optional use cases. E.g. asking which environments are currently active.
The environments themselves can be hierarchical. In that sense, that if you set a default property to STAGING
, it would also apply to
CUSTOM_ENVIRONMENT
, unless a different value is specifically set for CUSTOM_ENVIRONMENT
.
Also, a convenience DSL is available for setting properties. E.g.
WiseEnvironment.setDefaultProperties(dsl -> dsl
.source("tw-reliable-jdbc")
.environment(WiseEnvironment.WISE)
.set(TW_OBS_BASE_EXTREMUM_CONFIG_PATH, gaugeNames)
.set("spring.flyway.validate-migration-naming", "true")
.keyPrefix("tw-reliable-jdbc.")
.environment(WiseEnvironment.PRODUCTION)
.set("sslMode", SslMode.VERIFY_FULL)
.set("requiredSslModeLevel", SslMode.VERIFY_CA)
.set("requireMinPoolSizePct", 100d)
.environment(WiseEnvironment.STAGING)
.set("sslMode", SslMode.VERIFY_FULL)
);
Copyright 2024 TransferWise Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.