https://github.com/opentable/otj-versioned-config
Component for reading and polling for configuration from git
https://github.com/opentable/otj-versioned-config
platform-java
Last synced: 7 months ago
JSON representation
Component for reading and polling for configuration from git
- Host: GitHub
- URL: https://github.com/opentable/otj-versioned-config
- Owner: opentable
- License: apache-2.0
- Created: 2014-06-11T16:08:08.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2023-10-27T16:10:27.000Z (over 1 year ago)
- Last Synced: 2024-05-14T00:26:33.426Z (about 1 year ago)
- Topics: platform-java
- Language: Java
- Size: 241 KB
- Stars: 0
- Watchers: 18
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
otj-versioned-config
====================Component for reading and polling for configuration from git.
Usage
-----For Spring projects, in your configuration classes just import VersionedConfig. This will automatically determine the
Git repository to watch via application properties, and provide a `VersioningService` that tracks changes.You can also configure it manually if you prefer:
```java
VersioningService config = VersioningService.forGitRepo(
new VersioningServiceProperties()
.setRemoteConfigRepository("http://git.somewhere.com/..."));
```How it works
------------
The VersioningService maintains a local clone of the remote Git repository.
Any time you call `checkForUpdate()`, it will do a fetch of the remote repository,
and indicate whether any changes were found.At any time you may invoke `getCurrentState()` or `getLatestRevision()` to get the
state of the *local* repository.Remember to `close()` your versioning service when you are done with it to clean
up the local checkout. (This is done for you if you use the Spring integration.)Configuration Properties
------------------------
| Property name | Purpose | Example value |
| ------------- | ------- | ------------- |
| config.repo.remote | github repo URI | https://github.com/opentable/service-ot-frontdoor-config |
| config.repo.oauth-token | github oauth token |
| config.repo.username | username | *your username* |
| config.repo.password | password | *your password* |
| config.repo.local | where to check out repo locally (URI) | frontdoor-config |
| config.repo.branch | The branch in the configuration repo to read | master |**Note**: `config.repo.oauth-token` and `config.repo.username/password` are mutually exclusive.
You should use one or the other, but not both. (Setting an `oauth-token` automatically sets your
password to `"x-oauth-basic"`.)