Cloud Foundry Environment crate
A small library to get you going in not time with typed environment variables for you Cloud Foundry envirnoment.
Goals:
- Remove boilerplate code for projects using cf
- Use the power of rust to get the environment variables in a typed way
- Give you the flexiblity to define custom values such as credential structures to meet your needs
Usage
Getting this crate is easy as adding it to your dependencies
[]
= "0.0.1"
After that, just check what you need and get it, you may wanna check out the docs.rs page. For example CF_INSTANCE_INDEX
let instance_index = get_instance_index.unwrap;
Or for example if you need to get some credentials:
use ;
// After that you can use it
let service = .unwrap;
There is no need for typed credentials if you would like to parse it anyway and then deal with the Value enum from serde_json
use Value;
use Service;
let service: = get_service_by_name.unwrap;
let uri = service.credentials.as_str.unwrap;