New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

env_file

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

env_file

Source
crates.io
Version
0.1.3
Version published
Maintainers
0
Created
Source

This crate helps to read contents of a file with name taken from environment variable.

Build Status

Reading files with name taken from environment variable

Some applications have sensitive data, like API keys, which is unsafe to keep in VCS. One possible solution is keeping secret data in files, taking their names from environment variables. Say, you have to use cloud provider API key to control your PaaS system and you need a key for external data API. You can then run your application like:

$ CLOUD_API_KEY=/etc/secrets/cloud_api.key DATA_API_KEY=/etc/secrets/data_api.key your_app

The same pattern simplifies testing (with test keys and not production ones). It is extendable too: you may have a default location for production use with ability to override it via environment variables.

Usage

Add this to your Cargo.toml:

[dependencies]
env_file = "0.1"

and this to your crate root:

extern crate env_file;

Example

extern crate env_file;

let api_key = read("CLOUD_API_KEY").unwrap_or("default_key".to_string());

FAQs

Package last updated on 01 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts