ackee-report
Advanced tools
Comparing version 0.6.4 to 0.7.0-beta
@@ -1,7 +0,1 @@ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
## [v0.6.4] - 2021-01-05 | ||
@@ -8,0 +2,0 @@ |
{ | ||
"name": "ackee-report", | ||
"version": "0.6.4", | ||
"version": "0.7.0-beta", | ||
"description": "CLI tool to generate performance reports of websites using the self-hosted analytics tool Ackee.", | ||
@@ -31,2 +31,3 @@ "bin": "./src/index.js", | ||
"configstore": "^5.0.1", | ||
"dotenv": "^8.2.0", | ||
"ejs": "^3.1.5", | ||
@@ -39,6 +40,9 @@ "feed": "^4.2.1", | ||
"devDependencies": { | ||
"@betahuhn/eslint-config-node": "^0.1.0", | ||
"@betahuhn/config": "^1.0.2", | ||
"ejs-serve": "^1.0.2", | ||
"eslint": "^7.16.0" | ||
} | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
@@ -33,14 +33,18 @@ <div align="center"> | ||
- *ackee server* - the endpoint of your Ackee instance | ||
- *ackee token* - a permanent Ackee token (can be used instead of username and password, [more info](#ackee-api-authentication)) | ||
- *ackee username* - your Ackee username ([more info](#ackee-api-authentication)) | ||
- *ackee password* - your Ackee password ([more info](#ackee-api-authentication)) | ||
- *email host* - the domain of the email server ([more info](#email-setup)) | ||
- *email port* - the port of the email server ([more info](#email-setup)) | ||
- *email username* - the username to use with the email server ([more info](#email-setup)) | ||
- *email password* - the password to use with the email server ([more info](#email-setup)) | ||
- *email from* - the from address to use ([more info](#email-setup)) | ||
- *ackee server* / `ACKEE_SERVER` - the endpoint of your Ackee instance | ||
- *ackee token* / `ACKEE_TOKEN` - a permanent Ackee token (can be used instead of username and password, [more info](#ackee-api-authentication)) | ||
- *ackee username* `ACKEE_USERNAME` - your Ackee username ([more info](#ackee-api-authentication)) | ||
- *ackee password* `ACKEE_PASSWORD` - your Ackee password ([more info](#ackee-api-authentication)) | ||
- *email host* / `EMAIL_HOST` - the domain of the email server ([more info](#email-setup)) | ||
- *email port* / `EMAIL_PORT` - the port of the email server ([more info](#email-setup)) | ||
- *email username* / `EMAIL_USERNAME` - the username to use with the email server ([more info](#email-setup)) | ||
- *email password* / `EMAIL_PASSWORD` - the password to use with the email server ([more info](#email-setup)) | ||
- *email from* / `EMAIL_FROM` - the from address to use ([more info](#email-setup)) | ||
The configuration will be stored in your home directory under `~/.config/configstore/ackee-report.json` and can be changed at any point. | ||
### Environment Variables | ||
If you don't want to interact with [ackee-report](https://github.com/BetaHuhn/ackee-report) via the CLI interface, you can also specify each configuration option as an environment variable e.g. `ACKEE_TOKEN=<token>` | ||
### Ackee API authentication | ||
@@ -47,0 +51,0 @@ |
@@ -5,2 +5,4 @@ const Configstore = require('configstore') | ||
require('dotenv').config() | ||
const config = new Configstore(packageJson.name, {}) | ||
@@ -10,2 +12,7 @@ | ||
const getEnv = (key) => { | ||
const envKey = key.split('.').join('_').toUpperCase() | ||
return process.env[envKey] | ||
} | ||
const verifyField = (field) => { | ||
@@ -15,2 +22,8 @@ const existing = config.get(field) | ||
const env = getEnv(field) | ||
if (env !== undefined) { | ||
config.set(field, env) | ||
return | ||
} | ||
const text = field.split('.').join(' ') | ||
@@ -28,4 +41,13 @@ const required = !field.includes('email') | ||
const loadConfig = function() { | ||
if (!(config.get('ackee.token') || (config.get('ackee.username') && config.get('ackee.password')))) { | ||
const verifyAuth = () => { | ||
const envToken = getEnv('ackee.token') | ||
if (envToken !== undefined) { | ||
config.set('ackee.token', envToken) | ||
return | ||
} | ||
const configHasToken = config.get('ackee.token') !== undefined | ||
const configHasCreds = config.get('ackee.username') !== undefined && config.get('ackee.password') !== undefined | ||
if (configHasToken === false && configHasCreds === false) { | ||
const token = prompt('ackee token (press enter to skip): ') | ||
@@ -41,3 +63,7 @@ if (token.length < 1) { | ||
} | ||
} | ||
const loadConfig = function() { | ||
verifyAuth() | ||
fields.forEach((field) => { | ||
@@ -44,0 +70,0 @@ verifyField(field) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
80502
25
994
235
9
3
+ Addeddotenv@^8.2.0
+ Addeddotenv@8.6.0(transitive)