Skip to content

Commit

Permalink
README
Browse files Browse the repository at this point in the history
  • Loading branch information
viction committed Jan 22, 2020
1 parent 972d4c5 commit 2c2a274
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 4 deletions.
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Envuments - Your ideal config system

Envuments is an application configuration program that provides the ability to work with with .env files or your own seeded config.
The purpose of Envuments is to allow templating in your configuration files. Currently we support .env files as well as allowing you to seed your own config.
Syntax for templating and implementation can be found below.

When working with .env files, Envuments acts as an extension to the dotenv package which can be found [here](https://npmjs.com/dotenv).

 

## Implementation

### .env
```
APP_PORT=8443
APP_URL=http://localhost:${APP_PORT}
```

### index.js
```js
const { Envuments } = require('envuments');

const config = new Envuments();

const configValue = config.get("APP_URL", "https://viction.dev");

console.log(configValue); // http://localhost:8443
```

 

## Seeding your own config

### index.js
```js
const { Envuments } = require('envuments');

Envuments.SeedConfig({
APP_PORT: 8443,
APP_URL: "http://localhost:${APP_PORT}"
});

const config = new Envuments();

const configValue = config.get("APP_URL", "https://viction.dev");

console.log(configValue); // http://localhost:8443
```

---

If you want any configuration methods to be implemented please [open an issue](https://github.com/victiondev/envuments/issues).
4 changes: 1 addition & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import { Envuments } from "./Envuments";

export default Envuments;
export { Envuments } from "./Envuments";
2 changes: 1 addition & 1 deletion src/lib/Parser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Envuments from "../";
import { Envuments } from "../";

export class Parser {
private TEMPLATE_REGEX = /\${\w*}/g;
Expand Down

0 comments on commit 2c2a274

Please sign in to comment.