From 6aef5d2bc05937d5206a7926bfef790a1b8b4912 Mon Sep 17 00:00:00 2001 From: Jamie Magee Date: Sat, 16 Mar 2019 07:03:32 +0100 Subject: [PATCH] feat: validate renovate config file (#3389) Extend renovate-config-validator to validate `config.js` and `RENOVATE_CONFIG_FILE`. Also add the execute bit to `config-validator.js` Fixed #3388 --- bin/config-validator.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) mode change 100644 => 100755 bin/config-validator.js diff --git a/bin/config-validator.js b/bin/config-validator.js old mode 100644 new mode 100755 index 8ee1c7d83e..f700db3e8b --- a/bin/config-validator.js +++ b/bin/config-validator.js @@ -3,6 +3,7 @@ const fs = require('fs-extra'); const { validateConfig } = require('../lib/config/validation'); const { massageConfig } = require('../lib/config/massage'); +const { getConfig } = require('../lib/config/file'); const { initLogger } = require('../lib/logger'); const cache = require('../lib/workers/global/cache'); const { configFileNames } = require('../lib/config/app-strings'); @@ -63,6 +64,18 @@ async function validate(desc, config, isPreset = false) { } catch (err) { // ignore } + try { + const fileConfig = getConfig(process.env); + console.log(`Validating config.js`); + try { + await validate('config.js', fileConfig); + } catch (err) { + console.log(`config.js is not valid Renovate config`); + returnVal = 1; + } + } catch (err) { + // ignore + } if (returnVal !== 0) { process.exit(returnVal); }