Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/transferwise/wise-environment
https://github.com/transferwise/wise-environment
Last synced: 18 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/transferwise/wise-environment
- Owner: transferwise
- License: other
- Created: 2024-03-22T14:33:37.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-12-10T15:02:44.000Z (about 1 month ago)
- Last Synced: 2024-12-10T16:26:06.772Z (about 1 month ago)
- Language: Java
- Size: 157 KB
- Stars: 0
- Watchers: 38
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# Wise Environment.
![Apache 2](https://img.shields.io/hexpm/l/plug.svg)
![Java 17](https://img.shields.io/badge/Java-17-blue.svg)
![Maven Central](https://badgen.net/maven/v/maven-central/com.transferwise.common/wise-environment)
[![Owners](https://img.shields.io/badge/team-AppEng-blueviolet.svg?logo=wise)](https://transferwise.atlassian.net/wiki/spaces/EKB/pages/2520812116/Application+Engineering+Team) [![Slack](https://img.shields.io/badge/slack-appeng--pub-blue.svg?logo=slack)](https://wise.enterprise.slack.com/archives/C07QSPFLM5X)
> 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.
```java
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.
```java
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)
);
```## License
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 athttp://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.