From ad9378bc6221a7ef0c52dcbc4f925c87e5d0ee77 Mon Sep 17 00:00:00 2001 From: dblythy Date: Tue, 27 Jun 2023 14:36:43 +1000 Subject: [PATCH 1/2] fix: (LTS) Auth does not load when starting Parse Server via CLI --- spec/CLI.spec.js | 16 ++++++++++++++++ spec/configs/CLIConfigAuth.json | 11 +++++++++++ src/Options/Definitions.js | 2 +- src/Options/docs.js | 2 +- src/Options/index.js | 2 +- 5 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 spec/configs/CLIConfigAuth.json diff --git a/spec/CLI.spec.js b/spec/CLI.spec.js index 540f02abf6..0d63a27ce9 100644 --- a/spec/CLI.spec.js +++ b/spec/CLI.spec.js @@ -294,4 +294,20 @@ describe('execution', () => { done.fail(data.toString()); }); }); + + it('can start Parse Server with auth via CLI', done => { + const env = { ...process.env }; + env.NODE_OPTIONS = '--dns-result-order=ipv4first'; + childProcess = spawn(binPath, ['./spec/configs/CLIConfigAuth.json'], { env }); + childProcess.stdout.on('data', data => { + data = data.toString(); + if (data.includes('parse-server running on')) { + done(); + } + }); + childProcess.stderr.on('data', data => { + data = data.toString(); + done.fail(data.toString()); + }); + }); }); diff --git a/spec/configs/CLIConfigAuth.json b/spec/configs/CLIConfigAuth.json new file mode 100644 index 0000000000..61d1adb948 --- /dev/null +++ b/spec/configs/CLIConfigAuth.json @@ -0,0 +1,11 @@ +{ + "appName": "test", + "appId": "test", + "masterKey": "test", + "logLevel": "error", + "auth": { + "facebook": { + "appIds": "test" + } + } +} \ No newline at end of file diff --git a/src/Options/Definitions.js b/src/Options/Definitions.js index 26c90de081..0481a7aab5 100644 --- a/src/Options/Definitions.js +++ b/src/Options/Definitions.js @@ -4,6 +4,7 @@ This code has been generated by resources/buildConfigDefinitions.js Do not edit manually, but update Options/index.js */ var parsers = require('./parsers'); + module.exports.SchemaOptions = { afterMigration: { env: 'PARSE_SERVER_SCHEMA_AFTER_MIGRATION', @@ -94,7 +95,6 @@ module.exports.ParseServerOptions = { env: 'PARSE_SERVER_AUTH_PROVIDERS', help: 'Configuration for your authentication providers, as stringified JSON. See http://docs.parseplatform.org/parse-server/guide/#oauth-and-3rd-party-authentication', - action: parsers.arrayParser, }, cacheAdapter: { env: 'PARSE_SERVER_CACHE_ADAPTER', diff --git a/src/Options/docs.js b/src/Options/docs.js index 7f9995ad5f..7d0a444f02 100644 --- a/src/Options/docs.js +++ b/src/Options/docs.js @@ -19,7 +19,7 @@ * @property {Adapter} analyticsAdapter Adapter module for the analytics * @property {String} appId Your Parse Application ID * @property {String} appName Sets the app name - * @property {AuthAdapter[]} auth Configuration for your authentication providers, as stringified JSON. See http://docs.parseplatform.org/parse-server/guide/#oauth-and-3rd-party-authentication + * @property {Object} auth Configuration for your authentication providers, as stringified JSON. See http://docs.parseplatform.org/parse-server/guide/#oauth-and-3rd-party-authentication * @property {Adapter} cacheAdapter Adapter module for the cache * @property {Number} cacheMaxSize Sets the maximum size for the in memory cache, defaults to 10000 * @property {Number} cacheTTL Sets the TTL for the in memory cache (in ms), defaults to 5000 (5 seconds) diff --git a/src/Options/index.js b/src/Options/index.js index b3c47fcf00..e950f78ece 100644 --- a/src/Options/index.js +++ b/src/Options/index.js @@ -140,7 +140,7 @@ export interface ParseServerOptions { allowCustomObjectId: ?boolean; /* Configuration for your authentication providers, as stringified JSON. See http://docs.parseplatform.org/parse-server/guide/#oauth-and-3rd-party-authentication :ENV: PARSE_SERVER_AUTH_PROVIDERS */ - auth: ?(AuthAdapter[]); + auth: ?{ [string]: AuthAdapter }; /* Max file size for uploads, defaults to 20mb :DEFAULT: 20mb */ maxUploadSize: ?string; From 78417ea0192c7845c43477005d0e53ea9717503e Mon Sep 17 00:00:00 2001 From: dblythy Date: Thu, 29 Jun 2023 13:23:28 +1000 Subject: [PATCH 2/2] Update CLI.spec.js --- spec/CLI.spec.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/spec/CLI.spec.js b/spec/CLI.spec.js index 0d63a27ce9..6bb563d9bd 100644 --- a/spec/CLI.spec.js +++ b/spec/CLI.spec.js @@ -296,9 +296,7 @@ describe('execution', () => { }); it('can start Parse Server with auth via CLI', done => { - const env = { ...process.env }; - env.NODE_OPTIONS = '--dns-result-order=ipv4first'; - childProcess = spawn(binPath, ['./spec/configs/CLIConfigAuth.json'], { env }); + childProcess = spawn(binPath, ['./spec/configs/CLIConfigAuth.json'], { env: process.env }); childProcess.stdout.on('data', data => { data = data.toString(); if (data.includes('parse-server running on')) {