-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
viction
committed
Jan 22, 2020
1 parent
972d4c5
commit 2c2a274
Showing
3 changed files
with
54 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
import { Envuments } from "./Envuments"; | ||
|
||
export default Envuments; | ||
export { Envuments } from "./Envuments"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters