From d48ae99c8350fdd890a90858d7e8656aafc210f4 Mon Sep 17 00:00:00 2001 From: dblythy Date: Mon, 26 Jun 2023 17:29:23 +1000 Subject: [PATCH 1/5] fix: Auth does not load when starting Parse Server via CLI --- spec/CLI.spec.js | 16 ++++++++++++++++ spec/configs/CLIConfigAuth.json | 11 +++++++++++ 2 files changed, 27 insertions(+) create mode 100644 spec/configs/CLIConfigAuth.json diff --git a/spec/CLI.spec.js b/spec/CLI.spec.js index 20667fd349..7dd4fd141c 100644 --- a/spec/CLI.spec.js +++ b/spec/CLI.spec.js @@ -302,4 +302,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..37a2a5f373 --- /dev/null +++ b/spec/configs/CLIConfigAuth.json @@ -0,0 +1,11 @@ +{ + "appName": "test", + "appId": "test", + "masterKey": "test", + "logLevel": "error", + "auth": { + "facebook": { + "appIds": "test" + } + } +} From 88d9d6a5957210f1e641935f97e0315176d4729f Mon Sep 17 00:00:00 2001 From: dblythy Date: Mon, 26 Jun 2023 17:41:59 +1000 Subject: [PATCH 2/5] fix definition --- src/Options/Definitions.js | 1 - src/Options/docs.js | 2 +- src/Options/index.js | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Options/Definitions.js b/src/Options/Definitions.js index 6477836eed..7a1e56bad0 100644 --- a/src/Options/Definitions.js +++ b/src/Options/Definitions.js @@ -103,7 +103,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 fdb62bb590..09e6f5b3b4 100644 --- a/src/Options/docs.js +++ b/src/Options/docs.js @@ -20,7 +20,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 a8414c658c..d501b996dd 100644 --- a/src/Options/index.js +++ b/src/Options/index.js @@ -149,7 +149,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 c729d946a0fb3de9cf1ac0d8e1a2f49d4787f580 Mon Sep 17 00:00:00 2001 From: dblythy Date: Thu, 29 Jun 2023 13:46:59 +1000 Subject: [PATCH 3/5] Update CLI.spec.js --- spec/CLI.spec.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/CLI.spec.js b/spec/CLI.spec.js index 7dd4fd141c..a7d2dc0a1e 100644 --- a/spec/CLI.spec.js +++ b/spec/CLI.spec.js @@ -303,12 +303,13 @@ describe('execution', () => { }); }); - it('can start Parse Server with auth via CLI', done => { + fit('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(); + console.log(data); if (data.includes('parse-server running on')) { done(); } From 238d6811246d230dbd6f9cdb505d27abe5217252 Mon Sep 17 00:00:00 2001 From: dblythy Date: Thu, 29 Jun 2023 13:50:33 +1000 Subject: [PATCH 4/5] Update CLI.spec.js --- spec/CLI.spec.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/CLI.spec.js b/spec/CLI.spec.js index a7d2dc0a1e..51a16bde73 100644 --- a/spec/CLI.spec.js +++ b/spec/CLI.spec.js @@ -306,7 +306,11 @@ describe('execution', () => { fit('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, + ['--databaseURI', databaseURI, './spec/configs/CLIConfigAuth.json'], + { env } + ); childProcess.stdout.on('data', data => { data = data.toString(); console.log(data); From aeb8017914acd002e4e96c1af75eb0bd7a668db6 Mon Sep 17 00:00:00 2001 From: dblythy Date: Thu, 29 Jun 2023 13:53:29 +1000 Subject: [PATCH 5/5] Update CLI.spec.js --- spec/CLI.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/CLI.spec.js b/spec/CLI.spec.js index 51a16bde73..d73b854a9b 100644 --- a/spec/CLI.spec.js +++ b/spec/CLI.spec.js @@ -303,7 +303,7 @@ describe('execution', () => { }); }); - fit('can start Parse Server with auth via CLI', done => { + it('can start Parse Server with auth via CLI', done => { const env = { ...process.env }; env.NODE_OPTIONS = '--dns-result-order=ipv4first'; childProcess = spawn(