# config-autoload

> Npm package for autoloading configuration files

Latest version **0.2.4** (published 2015-12-22) · GNU license · 0 weekly downloads

## Install

```sh
npm install config-autoload
pnpm add config-autoload
yarn add config-autoload
bun add config-autoload
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.4 |
| Published | 2015-12-22 |
| First published | 2015-03-22 |
| Weekly downloads | 0 |
| License | GNU |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Domagoj Jerčić |
| Maintainers | domagojjercic |
| Keywords | configuration, autoload |

## Links

- npm: https://www.npmjs.com/package/config-autoload
- Repository: https://github.com/DJercic/config-autoload
- Homepage: https://github.com/DJercic/config-autoload#readme
- Issues: https://github.com/DJercic/config-autoload/issues
- npm.io page: https://npm.io/package/config-autoload

## Dependencies (1)

- [dotenv](https://npm.io/package/dotenv.md) ^1.2.0

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 0.2.4 (latest) — 2015-12-22
- 0.2.3 — 2015-12-22
- 0.2.2 — 2015-12-22
- 0.2.1 — 2015-12-22
- 0.1.1 — 2015-06-16
- 0.1.0 — 2015-06-16
- 0.0.5 — 2015-03-25
- 0.0.4 — 2015-03-22
- 0.0.3 — 2015-03-22
- 0.0.2 — 2015-03-22
- 0.0.1 — 2015-03-22

## README

# config-autoload
Npm module for autoloading config files. It uses https://github.com/motdotla/dotenv module for loading environment variables from .env file

#quick start
create same folder and file structure
```
	myapp/config
	myapp/config/.env
	myapp/config/config.js
```
	
config.js example : 

```javascript
var path = require('path');
var _ = require('lodash');

module.exports = {
	path : path.normalize(__dirname + "/.."),
	name : process.env.NAME,
	port : _.parseInt( process.env.PORT )
};
````
.env example 
```
NAME=xyz
PORT=3306
```


later in code require config-autoload and have access to object defined in config.js
```javascript
var config = require('config-autoload');
console.log(config); 
//output
{ 
	path : '/home/xyz/myapp/', 
	name : 'xyz', 
	port : 3306  
}
```





create a folder for config files
	myapp/config

for development create a .env file with env variables 

	myapp/config/.env


create a config.js file for handling variables

	myapp/config/config.js

---
_Source: https://npm.io/package/config-autoload · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
