Linting fixes

This commit is contained in:
Jamie Curnow 2023-03-21 17:11:16 +10:00
parent ea61b15a40
commit c3469de61b
No known key found for this signature in database
GPG Key ID: FFBB624C43388E9E
6 changed files with 377 additions and 398 deletions

4
Jenkinsfile vendored
View File

@ -14,9 +14,9 @@ pipeline {
ansiColor('xterm')
}
environment {
IMAGE = "nginx-proxy-manager"
IMAGE = 'nginx-proxy-manager'
BUILD_VERSION = getVersion()
MAJOR_VERSION = "2"
MAJOR_VERSION = '2'
BRANCH_LOWER = "${BRANCH_NAME.toLowerCase().replaceAll('/', '-')}"
COMPOSE_PROJECT_NAME = "npm_${BRANCH_LOWER}_${BUILD_NUMBER}"
COMPOSE_FILE = 'docker/docker-compose.ci.yml'

View File

@ -1,6 +1,5 @@
#!/usr/bin/env node
const fs = require('fs');
const logger = require('./logger').global;
async function appStart () {

View File

@ -1,6 +1,5 @@
const fs = require('fs');
const NodeRSA = require('node-rsa');
const { config } = require('process');
const logger = require('../logger').global;
const keysFile = '/data/keys.json';
@ -18,7 +17,8 @@ const configure = () => {
} catch (err) {
// do nothing
}
if (configData?.database && configData?.database?.engine) {
if (configData && configData.database) {
logger.info(`Using configuration from file: ${filename}`);
instance = configData;
return;
@ -48,8 +48,8 @@ const configure = () => {
logger.info(`Using Sqlite: ${envSqliteFile}`);
instance = {
database: {
engine: 'knex-native',
knex: {
engine: 'knex-native',
knex: {
client: 'sqlite3',
connection: {
filename: envSqliteFile
@ -62,7 +62,7 @@ const configure = () => {
// Get keys from file
if (!fs.existsSync(keysFile)) {
generateKeys();
} else if (!!process.env.DEBUG) {
} else if (process.env.DEBUG) {
logger.info('Keys file exists OK');
}
try {
@ -106,8 +106,8 @@ module.exports = {
has: function(key) {
instance === null && configure();
const keys = key.split('.');
let level = instance;
let has = true;
let level = instance;
let has = true;
keys.forEach((keyItem) =>{
if (typeof level[keyItem] === 'undefined') {
has = false;
@ -140,7 +140,7 @@ module.exports = {
*/
isSqlite: function () {
instance === null && configure();
return instance.database?.knex && instance.database?.knex?.client === 'sqlite3';
return instance.database.knex && instance.database.knex.client === 'sqlite3';
},
/**
@ -159,7 +159,7 @@ module.exports = {
*/
getPublicKey: function () {
instance === null && configure();
return instance?.keys?.pub
return instance.keys.pub;
},
/**
@ -169,7 +169,7 @@ module.exports = {
*/
getPrivateKey: function () {
instance === null && configure();
return instance?.keys?.key;
return instance.keys.key;
},
/**

View File

@ -22,7 +22,7 @@ module.exports = function () {
*/
create: (payload) => {
if (!config.getPrivateKey()) {
logger.error('Private key is empty!')
logger.error('Private key is empty!');
}
// sign with RSA SHA256
const options = {
@ -55,7 +55,7 @@ module.exports = function () {
*/
load: function (token) {
if (!config.getPublicKey()) {
logger.error('Public key is empty!')
logger.error('Public key is empty!');
}
return new Promise((resolve, reject) => {
try {

View File

@ -21,7 +21,6 @@
"moment": "^2.29.4",
"mysql": "^2.18.1",
"node-rsa": "^1.0.8",
"nodemon": "^2.0.2",
"objection": "3.0.1",
"path": "^0.12.7",
"signale": "1.4.0",
@ -35,8 +34,9 @@
"author": "Jamie Curnow <jc@jc21.com>",
"license": "MIT",
"devDependencies": {
"eslint": "^6.8.0",
"eslint": "^8.36.0",
"eslint-plugin-align-assignments": "^1.1.2",
"nodemon": "^2.0.2",
"prettier": "^2.0.4"
}
}

File diff suppressed because it is too large Load Diff