Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/media-service-dev/environment
A library to load .env files and interact with the environment
https://github.com/media-service-dev/environment
dotenv environment library typescript
Last synced: 11 days ago
JSON representation
A library to load .env files and interact with the environment
- Host: GitHub
- URL: https://github.com/media-service-dev/environment
- Owner: media-service-dev
- License: mit
- Created: 2020-03-18T09:18:44.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-12-16T11:27:53.000Z (about 3 years ago)
- Last Synced: 2024-12-12T09:52:45.782Z (about 2 months ago)
- Topics: dotenv, environment, library, typescript
- Language: TypeScript
- Homepage: https://media-service.com/
- Size: 539 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @mscs/environment
A library to load and interact with the environment.
## Installation
```shell script
$ yarn add @mscs/environment
```## Usage
Short example:
```typescript
import { EnvironmentLoader, ProcessEnvironment } from "@mscs/environment";async function runtime(){
const environment = new ProcessEnvironment();
const environmentLoader = new EnvironmentLoader(environment);await environmentLoader.loadEnvironment(__dirname + '/../.env');
if(environment.has('FOO')){
const foo = environment.get("FOO");
// ...
}
}runtime()
.catch(console.error);
```*This example expect that you are in a root file of the `src` directory in your project.*
## Documentation
Currently, you have to build the documentation on your own.
```shell script
$ git clone [email protected]:media-service-dev/environment.git
$ cd environment
$ yarn
$ yarn run docs
```# Important note
The parser for `.env`-files and the environment file loading order logic was ported from [Symfony](https://symfony.com/).
Since *Symfony* is, for good reason, a registered trademark, please take note that we are in no way associated with [the Symfony brand](https://symfony.com/) or the [SensioLabs](https://sensiolabs.com/) organization.
Therefore, we don't represent or speak for any of them.