Crate cf_env

Source
Expand description

Easy and typed abstraction on Cloud Foundry Environment variables

It allows you to get:

  • Services, optionally filtered by name or type
  • Application infos
  • Cloud Foundry app instance set variables, most of the times starting with CF_

It’s meant to get you away from boilerplating and get you started with typed variables while keeping simplicity

Modules§

constants
enums
models

Functions§

get_application_info
Get’s you the information from VCAP_APPLICATION as a typed Application
get_database_url
Get’s the value from DATABASE_URL as a typed Uri
get_home
Get’s the value from HOME as a typed PathBuf
get_instance_address
Get’s the value from CF_INSTANCE_ADDR as a typed SocketAddr
get_instance_guid
Get’s the value from CF_INSTANCE_GUID as a typed GUID
get_instance_index
Get’s the value from CF_INSTANCE_INDEX as a typed u128
get_instance_internal_ip
Get’s the value from CF_INSTANCE_INTERNAL_IP as a typed IpAddr
get_instance_ip
Get’s the value from CF_INSTANCE_IP as a typed IpAddr
get_instance_port
Get’s the value from CF_INSTANCE_PORT as a typed u16
get_lang
Get’s the value from LANG as a typed Locale
get_memory_limit
Get’s the value from MEMORY_LIMIT as a typed MemoryLimit
get_port
Get’s the value from PORT as a typed 16
get_pwd
Get’s the value from PWD as a typed PathBuf
get_service_by_name
Get’s you a single service fromVCAP_SERVICES by it’s name
get_services
Get’s the value from VCAP_SERVICES as a typed HashMap of Strings and a list of Services
get_services_by_type
Get’s you a a list services fromVCAP_SERVICES by their type
get_tmp_dir
Get’s the value from TMPDIR as a typed PathBuf
get_user
Get’s the value from USER
is_cf_env
Checks if VCAP_APPLICATION is defined, if so uses as the indicator that the app is running in a Cloud Foundry Environment.