Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sryze/dotenv
Load .env files in C++
https://github.com/sryze/dotenv
cplusplus dotenv library
Last synced: about 1 month ago
JSON representation
Load .env files in C++
- Host: GitHub
- URL: https://github.com/sryze/dotenv
- Owner: sryze
- License: mit
- Created: 2020-08-09T15:59:03.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-09-08T16:45:37.000Z (4 months ago)
- Last Synced: 2024-09-08T18:42:59.584Z (4 months ago)
- Topics: cplusplus, dotenv, library
- Language: C++
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
dotenv
======[![Build Status][build_status]][build]
Example code:
```c++
#include
#include "dotenv.h"int main() {
dotenv::load();auto foo = dotenv::get("FOO");
std::cout << "FOO = " << foo << std::endl;// It also works with getenv() from the standard library:
auto bar = getenv("BAR");
if (bar != nullptr) {
std::cout << "BAR = " << bar << std::endl;
}
}
```In your .env file:
```sh
FOO=hello
BAR=world
```There is also a command-line tool that can run any program with a user-provided
env-file, e.g.:```
./dotenv /path/to/.env -- sh -c 'echo $FOO'
```[build]: https://travis-ci.org/sryze/dotenv
[build_status]: https://travis-ci.org/sryze/dotenv.svg?branch=master