nav tabs on admin dashboard
This commit is contained in:
43
node_modules/dotenv/CHANGELOG.md
generated
vendored
43
node_modules/dotenv/CHANGELOG.md
generated
vendored
@@ -4,6 +4,43 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [6.2.0] - 2018-12-03
|
||||
|
||||
### Added
|
||||
|
||||
- Support preload configuration via environment variables ([#351](https://github.com/motdotla/dotenv/issues/351))
|
||||
|
||||
## [6.1.0] - 2018-10-08
|
||||
|
||||
### Added
|
||||
|
||||
- `debug` option for `config` and `parse` methods will turn on logging
|
||||
|
||||
## [6.0.0] - 2018-06-02
|
||||
|
||||
### Changed
|
||||
|
||||
- *Breaking:* drop support for Node v4 ([#304](https://github.com/motdotla/dotenv/pull/304))
|
||||
|
||||
## [5.0.0] - 2018-01-29
|
||||
|
||||
### Added
|
||||
|
||||
- Testing against Node v8 and v9
|
||||
- Documentation on trim behavior of values
|
||||
- Documentation on how to use with `import`
|
||||
|
||||
### Changed
|
||||
|
||||
- *Breaking*: default `path` is now `path.resolve(process.cwd(), '.env')`
|
||||
- *Breaking*: does not write over keys already in `process.env` if the key has a falsy value
|
||||
- using `const` and `let` instead of `var`
|
||||
|
||||
### Removed
|
||||
|
||||
- Testing against Node v7
|
||||
|
||||
|
||||
## [4.0.0] - 2016-12-23
|
||||
### Changed
|
||||
|
||||
@@ -67,7 +104,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
### Removed
|
||||
- support for multiple `.env` files. should always use one `.env` file for the current environment
|
||||
|
||||
[Unreleased]: https://github.com/motdotla/dotenv/compare/v4.0.0...HEAD
|
||||
[Unreleased]: https://github.com/motdotla/dotenv/compare/v6.2.0...HEAD
|
||||
[6.2.0]: https://github.com/motdotla/dotenv/compare/v6.1.0...v6.2.0
|
||||
[6.1.0]: https://github.com/motdotla/dotenv/compare/v6.0.0...v6.1.0
|
||||
[6.0.0]: https://github.com/motdotla/dotenv/compare/v5.0.0...v6.0.0
|
||||
[5.0.0]: https://github.com/motdotla/dotenv/compare/v4.0.0...v5.0.0
|
||||
[4.0.0]: https://github.com/motdotla/dotenv/compare/v3.0.0...v4.0.0
|
||||
[3.0.0]: https://github.com/motdotla/dotenv/compare/v2.0.0...v3.0.0
|
||||
[2.0.0]: https://github.com/motdotla/dotenv/compare/v1.2.0...v2.0.0
|
||||
|
||||
129
node_modules/dotenv/README.md
generated
vendored
129
node_modules/dotenv/README.md
generated
vendored
@@ -5,6 +5,7 @@
|
||||
Dotenv is a zero-dependency module that loads environment variables from a `.env` file into [`process.env`](https://nodejs.org/docs/latest/api/process.html#process_process_env). Storing configuration in the environment separate from code is based on [The Twelve-Factor App](http://12factor.net/config) methodology.
|
||||
|
||||
[](https://travis-ci.org/motdotla/dotenv)
|
||||
[](https://ci.appveyor.com/project/motdotla/dotenv/branch/master)
|
||||
[](https://www.npmjs.com/package/dotenv)
|
||||
[](https://github.com/feross/standard)
|
||||
[](https://coveralls.io/github/motdotla/dotenv?branch=coverall-intergration)
|
||||
@@ -12,7 +13,11 @@ Dotenv is a zero-dependency module that loads environment variables from a `.env
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm install dotenv --save
|
||||
# with npm
|
||||
npm install dotenv
|
||||
|
||||
# or with Yarn
|
||||
yarn add dotenv
|
||||
```
|
||||
|
||||
## Usage
|
||||
@@ -27,7 +32,7 @@ Create a `.env` file in the root directory of your project. Add
|
||||
environment-specific variables on new lines in the form of `NAME=VALUE`.
|
||||
For example:
|
||||
|
||||
```
|
||||
```dosini
|
||||
DB_HOST=localhost
|
||||
DB_USER=root
|
||||
DB_PASS=s1mpl3
|
||||
@@ -38,7 +43,7 @@ That's it.
|
||||
`process.env` now has the keys and values you defined in your `.env` file.
|
||||
|
||||
```javascript
|
||||
var db = require('db')
|
||||
const db = require('db')
|
||||
db.connect({
|
||||
host: process.env.DB_HOST,
|
||||
username: process.env.DB_USER,
|
||||
@@ -48,8 +53,7 @@ db.connect({
|
||||
|
||||
### Preload
|
||||
|
||||
If you are using iojs-v1.6.0 or later, you can use the `--require` (`-r`) command line option to preload dotenv. By doing this, you do not need to require and load dotenv in your application code.
|
||||
|
||||
You can use the `--require` (`-r`) [command line option](https://nodejs.org/api/cli.html#cli_r_require_module) to preload dotenv. By doing this, you do not need to require and load dotenv in your application code. This is the preferred approach when using `import` instead of `require`.
|
||||
|
||||
```bash
|
||||
$ node -r dotenv/config your_script.js
|
||||
@@ -61,37 +65,66 @@ The configuration options below are supported as command line arguments in the f
|
||||
$ node -r dotenv/config your_script.js dotenv_config_path=/custom/path/to/your/env/vars
|
||||
```
|
||||
|
||||
Additionally, you can use environment variables to set configuration options. Command line arguments will precede these.
|
||||
|
||||
```bash
|
||||
$ DOTENV_CONFIG_<OPTION>=value node -r dotenv/config your_script.js
|
||||
```
|
||||
|
||||
```bash
|
||||
$ DOTENV_CONFIG_ENCODING=base64 node -r dotenv/config your_script.js dotenv_config_path=/custom/path/to/.env
|
||||
```
|
||||
|
||||
## Config
|
||||
|
||||
_Alias: `load`_
|
||||
|
||||
`config` will read your .env file, parse the contents, assign it to
|
||||
[`process.env`](https://nodejs.org/docs/latest/api/process.html#process_process_env),
|
||||
and return an Object with a _parsed_ key containing the loaded content or an _error_ key if it failed.
|
||||
and return an Object with a `parsed` key containing the loaded content or an `error` key if it failed.
|
||||
|
||||
```js
|
||||
const result = dotenv.config()
|
||||
|
||||
if (result.error) {
|
||||
throw result.error
|
||||
}
|
||||
|
||||
console.log(result.parsed)
|
||||
```
|
||||
|
||||
You can additionally, pass options to `config`.
|
||||
|
||||
### Options
|
||||
|
||||
#### Path
|
||||
|
||||
Default: `.env`
|
||||
Default: `path.resolve(process.cwd(), '.env')`
|
||||
|
||||
You can specify a custom path if your file containing environment variables is
|
||||
named or located differently.
|
||||
You may specify a custom path if your file containing environment variables is located elsewhere.
|
||||
|
||||
```js
|
||||
require('dotenv').config({path: '/custom/path/to/your/env/vars'})
|
||||
require('dotenv').config({ path: '/full/custom/path/to/your/env/vars' })
|
||||
```
|
||||
|
||||
#### Encoding
|
||||
|
||||
Default: `utf8`
|
||||
|
||||
You may specify the encoding of your file containing environment variables
|
||||
using this option.
|
||||
You may specify the encoding of your file containing environment variables.
|
||||
|
||||
```js
|
||||
require('dotenv').config({encoding: 'base64'})
|
||||
require('dotenv').config({ encoding: 'base64' })
|
||||
```
|
||||
|
||||
#### Debug
|
||||
|
||||
Default: `false`
|
||||
|
||||
You may turn on logging to help debug why certain keys or values are not being set as you expect.
|
||||
|
||||
```js
|
||||
require('dotenv').config({ debug: process.env.DEBUG })
|
||||
```
|
||||
|
||||
## Parse
|
||||
@@ -101,12 +134,28 @@ variables is available to use. It accepts a String or Buffer and will return
|
||||
an Object with the parsed keys and values.
|
||||
|
||||
```js
|
||||
var dotenv = require('dotenv')
|
||||
var buf = new Buffer('BASIC=basic')
|
||||
var config = dotenv.parse(buf) // will return an object
|
||||
const dotenv = require('dotenv')
|
||||
const buf = Buffer.from('BASIC=basic')
|
||||
const config = dotenv.parse(buf) // will return an object
|
||||
console.log(typeof config, config) // object { BASIC : 'basic' }
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
#### Debug
|
||||
|
||||
Default: `false`
|
||||
|
||||
You may turn on logging to help debug why certain keys or values are not being set as you expect.
|
||||
|
||||
```js
|
||||
const dotenv = require('dotenv')
|
||||
const buf = Buffer.from('hello world')
|
||||
const opt = { debug: true }
|
||||
const config = dotenv.parse(buf, opt)
|
||||
// expect a debug message because the buffer is not in KEY=VAL form
|
||||
```
|
||||
|
||||
### Rules
|
||||
|
||||
The parsing engine currently supports the following rules:
|
||||
@@ -122,7 +171,9 @@ The parsing engine currently supports the following rules:
|
||||
{MULTILINE: 'new
|
||||
line'}
|
||||
```
|
||||
|
||||
- inner quotes are maintained (think JSON) (`JSON={"foo": "bar"}` becomes `{JSON:"{\"foo\": \"bar\"}"`)
|
||||
- whitespace is removed from both ends of the value (see more on [`trim`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim)) (`FOO=" some value "` becomes `{FOO: 'some value'}`)
|
||||
|
||||
## FAQ
|
||||
|
||||
@@ -151,7 +202,7 @@ If you want to override `process.env` you can do something like this:
|
||||
const fs = require('fs')
|
||||
const dotenv = require('dotenv')
|
||||
const envConfig = dotenv.parse(fs.readFileSync('.env.override'))
|
||||
for (var k in envConfig) {
|
||||
for (let k in envConfig) {
|
||||
process.env[k] = envConfig[k]
|
||||
}
|
||||
```
|
||||
@@ -163,17 +214,49 @@ the parsed `.env` file. This gives you everything you need to continue
|
||||
setting values on `process.env`. For example:
|
||||
|
||||
```js
|
||||
var dotenv = require('dotenv')
|
||||
var variableExpansion = require('dotenv-expand')
|
||||
const dotenv = require('dotenv')
|
||||
const variableExpansion = require('dotenv-expand')
|
||||
const myEnv = dotenv.config()
|
||||
variableExpansion(myEnv)
|
||||
```
|
||||
|
||||
### What about variable expansion?
|
||||
|
||||
For `dotenv@2.x.x`: Use [dotenv-expand](https://github.com/motdotla/dotenv-expand).
|
||||
Try [dotenv-expand](https://github.com/motdotla/dotenv-expand)
|
||||
|
||||
For `dotenv@1.x.x`: We haven't been presented with a compelling use case for expanding variables and believe it leads to env vars that are not "fully orthogonal" as [The Twelve-Factor App](http://12factor.net/config) outlines.<sup>[[1](https://github.com/motdotla/dotenv/issues/39)][[2](https://github.com/motdotla/dotenv/pull/97)]</sup> Please open an issue if you have a compelling use case.
|
||||
### How do I use dotenv with `import`?
|
||||
|
||||
ES2015 and beyond offers modules that allow you to `export` any top-level `function`, `class`, `var`, `let`, or `const`.
|
||||
|
||||
> When you run a module containing an `import` declaration, the modules it imports are loaded first, then each module body is executed in a depth-first traversal of the dependency graph, avoiding cycles by skipping anything already executed.
|
||||
>
|
||||
> – [ES6 In Depth: Modules](https://hacks.mozilla.org/2015/08/es6-in-depth-modules/)
|
||||
|
||||
You must run `dotenv.config()` before referencing any environment variables. Here's an example of problematic code:
|
||||
|
||||
`errorReporter.js`:
|
||||
|
||||
```js
|
||||
import { Client } from 'best-error-reporting-service'
|
||||
|
||||
export const client = new Client(process.env.BEST_API_KEY)
|
||||
```
|
||||
|
||||
`index.js`:
|
||||
|
||||
```js
|
||||
import dotenv from 'dotenv'
|
||||
import errorReporter from './errorReporter'
|
||||
|
||||
dotenv.config()
|
||||
errorReporter.client.report(new Error('faq example'))
|
||||
```
|
||||
|
||||
`client` will not be configured correctly because it was constructed before `dotenv.config()` was executed. There are (at least) 3 ways to make this work.
|
||||
|
||||
1. Preload dotenv: `node --require dotenv/config index.js` (_Note: you do not need to `import` dotenv with this approach_)
|
||||
2. Import `dotenv/config` instead of `dotenv` (_Note: you do not need to call `dotenv.config()` and must pass options via the command line with this approach_)
|
||||
3. Create a separate file that will execute `config` first as outlined in [this comment on #133](https://github.com/motdotla/dotenv/issues/133#issuecomment-255298822)
|
||||
|
||||
## Contributing Guide
|
||||
|
||||
@@ -206,3 +289,7 @@ Here's some projects that expand on dotenv. Check them out.
|
||||
* [require-environment-variables](https://github.com/bjoshuanoah/require-environment-variables)
|
||||
* [dotenv-safe](https://github.com/rolodato/dotenv-safe)
|
||||
* [envalid](https://github.com/af/envalid)
|
||||
* [lookenv](https://github.com/RodrigoEspinosa/lookenv)
|
||||
* [run.env](https://www.npmjs.com/package/run.env)
|
||||
* [dotenv-webpack](https://github.com/mrsteele/dotenv-webpack)
|
||||
* [env-path](https://github.com/benrei/env-path)
|
||||
|
||||
18
node_modules/dotenv/config.js
generated
vendored
18
node_modules/dotenv/config.js
generated
vendored
@@ -1,11 +1,11 @@
|
||||
(function () {
|
||||
var options = {}
|
||||
process.argv.forEach(function (val, idx, arr) {
|
||||
var matches = val.match(/^dotenv_config_(.+)=(.+)/)
|
||||
if (matches) {
|
||||
options[matches[1]] = matches[2]
|
||||
}
|
||||
})
|
||||
/* @flow */
|
||||
|
||||
require('./lib/main').config(options)
|
||||
(function () {
|
||||
require('./lib/main').config(
|
||||
Object.assign(
|
||||
{},
|
||||
require('./lib/env-options'),
|
||||
require('./lib/cli-options')(process.argv)
|
||||
)
|
||||
)
|
||||
})()
|
||||
|
||||
85
node_modules/dotenv/lib/main.js
generated
vendored
85
node_modules/dotenv/lib/main.js
generated
vendored
@@ -1,28 +1,51 @@
|
||||
'use strict'
|
||||
/* @flow */
|
||||
/*::
|
||||
|
||||
var fs = require('fs')
|
||||
type DotenvParseOptions = {
|
||||
debug?: boolean
|
||||
}
|
||||
|
||||
// keys and values from src
|
||||
type DotenvParseOutput = { [string]: string }
|
||||
|
||||
type DotenvConfigOptions = {
|
||||
path?: string, // path to .env file
|
||||
encoding?: string, // encoding of .env file
|
||||
debug?: string // turn on logging for debugging purposes
|
||||
}
|
||||
|
||||
type DotenvConfigOutput = {
|
||||
parsed?: DotenvParseOutput,
|
||||
error?: Error
|
||||
}
|
||||
|
||||
/*
|
||||
* Parses a string or buffer into an object
|
||||
* @param {String|Buffer} src - source to be parsed
|
||||
* @returns {Object}
|
||||
*/
|
||||
function parse (src) {
|
||||
var obj = {}
|
||||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
function log (message /*: string */) {
|
||||
console.log(`[dotenv][DEBUG] ${message}`)
|
||||
}
|
||||
|
||||
// Parses src into an Object
|
||||
function parse (src /*: string | Buffer */, options /*: ?DotenvParseOptions */) /*: DotenvParseOutput */ {
|
||||
const debug = Boolean(options && options.debug)
|
||||
const obj = {}
|
||||
|
||||
// convert Buffers before splitting into lines and processing
|
||||
src.toString().split('\n').forEach(function (line) {
|
||||
src.toString().split('\n').forEach(function (line, idx) {
|
||||
// matching "KEY' and 'VAL' in 'KEY=VAL'
|
||||
var keyValueArr = line.match(/^\s*([\w\.\-]+)\s*=\s*(.*)?\s*$/)
|
||||
const keyValueArr = line.match(/^\s*([\w.-]+)\s*=\s*(.*)?\s*$/)
|
||||
// matched?
|
||||
if (keyValueArr != null) {
|
||||
var key = keyValueArr[1]
|
||||
const key = keyValueArr[1]
|
||||
|
||||
// default undefined or missing values to empty string
|
||||
var value = keyValueArr[2] ? keyValueArr[2] : ''
|
||||
let value = keyValueArr[2] || ''
|
||||
|
||||
// expand newlines in quoted values
|
||||
var len = value ? value.length : 0
|
||||
const len = value ? value.length : 0
|
||||
if (len > 0 && value.charAt(0) === '"' && value.charAt(len - 1) === '"') {
|
||||
value = value.replace(/\\n/gm, '\n')
|
||||
}
|
||||
@@ -31,39 +54,45 @@ function parse (src) {
|
||||
value = value.replace(/(^['"]|['"]$)/g, '').trim()
|
||||
|
||||
obj[key] = value
|
||||
} else if (debug) {
|
||||
log(`did not match key and value when parsing line ${idx + 1}: ${line}`)
|
||||
}
|
||||
})
|
||||
|
||||
return obj
|
||||
}
|
||||
|
||||
/*
|
||||
* Main entry point into dotenv. Allows configuration before loading .env
|
||||
* @param {Object} options - valid options: path ('.env'), encoding ('utf8')
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
function config (options) {
|
||||
var path = '.env'
|
||||
var encoding = 'utf8'
|
||||
// Populates process.env from .env file
|
||||
function config (options /*: ?DotenvConfigOptions */) /*: DotenvConfigOutput */ {
|
||||
let dotenvPath = path.resolve(process.cwd(), '.env')
|
||||
let encoding /*: string */ = 'utf8'
|
||||
let debug = false
|
||||
|
||||
if (options) {
|
||||
if (options.path) {
|
||||
path = options.path
|
||||
if (options.path != null) {
|
||||
dotenvPath = options.path
|
||||
}
|
||||
if (options.encoding) {
|
||||
if (options.encoding != null) {
|
||||
encoding = options.encoding
|
||||
}
|
||||
if (options.debug != null) {
|
||||
debug = true
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
// specifying an encoding returns a string instead of a buffer
|
||||
var parsedObj = parse(fs.readFileSync(path, { encoding: encoding }))
|
||||
const parsed = parse(fs.readFileSync(dotenvPath, { encoding }), { debug })
|
||||
|
||||
Object.keys(parsedObj).forEach(function (key) {
|
||||
process.env[key] = process.env[key] || parsedObj[key]
|
||||
Object.keys(parsed).forEach(function (key) {
|
||||
if (!process.env.hasOwnProperty(key)) {
|
||||
process.env[key] = parsed[key]
|
||||
} else if (debug) {
|
||||
log(`"${key}" is already defined in \`process.env\` and will not be overwritten`)
|
||||
}
|
||||
})
|
||||
|
||||
return { parsed: parsedObj }
|
||||
return { parsed }
|
||||
} catch (e) {
|
||||
return { error: e }
|
||||
}
|
||||
|
||||
50
node_modules/dotenv/package.json
generated
vendored
50
node_modules/dotenv/package.json
generated
vendored
@@ -1,30 +1,27 @@
|
||||
{
|
||||
"_from": "dotenv@^4.0.0",
|
||||
"_id": "dotenv@4.0.0",
|
||||
"_from": "dotenv@^6.2.0",
|
||||
"_id": "dotenv@6.2.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-hk7xN5rO1Vzm+V3r7NzhefegzR0=",
|
||||
"_integrity": "sha512-HygQCKUBSFl8wKQZBSemMywRWcEDNidvNbjGVyZu3nbZ8qq9ubiPoGLMdRDpfSrpkkm9BXYFkpKxxFX38o/76w==",
|
||||
"_location": "/dotenv",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "dotenv@^4.0.0",
|
||||
"raw": "dotenv@^6.2.0",
|
||||
"name": "dotenv",
|
||||
"escapedName": "dotenv",
|
||||
"rawSpec": "^4.0.0",
|
||||
"rawSpec": "^6.2.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^4.0.0"
|
||||
"fetchSpec": "^6.2.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/laravel-mix"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/dotenv/-/dotenv-4.0.0.tgz",
|
||||
"_shasum": "864ef1379aced55ce6f95debecdce179f7a0cd1d",
|
||||
"_spec": "dotenv@^4.0.0",
|
||||
"_resolved": "https://registry.npmjs.org/dotenv/-/dotenv-6.2.0.tgz",
|
||||
"_shasum": "941c0410535d942c8becf28d3f357dbd9d476064",
|
||||
"_spec": "dotenv@^6.2.0",
|
||||
"_where": "C:\\xampp\\htdocs\\w4rpservices\\node_modules\\laravel-mix",
|
||||
"author": {
|
||||
"name": "scottmotte"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/motdotla/dotenv/issues"
|
||||
},
|
||||
@@ -33,17 +30,15 @@
|
||||
"deprecated": false,
|
||||
"description": "Loads environment variables from .env file",
|
||||
"devDependencies": {
|
||||
"babel": "5.8.23",
|
||||
"coveralls": "^2.11.9",
|
||||
"lab": "11.1.0",
|
||||
"semver": "5.3.0",
|
||||
"should": "11.1.1",
|
||||
"sinon": "1.17.6",
|
||||
"standard": "8.4.0",
|
||||
"standard-markdown": "2.2.0"
|
||||
"decache": "^4.5.0",
|
||||
"flow-bin": "^0.84.0",
|
||||
"sinon": "^6.3.5",
|
||||
"standard": "^12.0.1",
|
||||
"standard-markdown": "^5.0.1",
|
||||
"tap": "^12.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.6.0"
|
||||
"node": ">=6"
|
||||
},
|
||||
"homepage": "https://github.com/motdotla/dotenv#readme",
|
||||
"keywords": [
|
||||
@@ -63,11 +58,16 @@
|
||||
"url": "git://github.com/motdotla/dotenv.git"
|
||||
},
|
||||
"scripts": {
|
||||
"flow": "flow",
|
||||
"lint": "standard",
|
||||
"lint-md": "standard-markdown",
|
||||
"postlint": "npm run lint-md",
|
||||
"postlint": "standard-markdown",
|
||||
"pretest": "npm run lint",
|
||||
"test": "lab test/* -r lcov | coveralls"
|
||||
"test": "tap tests/*.js --100"
|
||||
},
|
||||
"version": "4.0.0"
|
||||
"standard": {
|
||||
"ignore": [
|
||||
"flow-typed/"
|
||||
]
|
||||
},
|
||||
"version": "6.2.0"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user