Skip to content

Commit 56a01cc

Browse files
committed
Update to the buildConfigDefinitions to support String|String[]
1 parent 15a25de commit 56a01cc

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

resources/buildConfigDefinitions.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ function mapperFor(elt, t) {
161161
if (type == 'NumberOrBoolean') {
162162
return wrap(t.identifier('numberOrBooleanParser'));
163163
}
164+
if (type === 'StringOrStringArray') {
165+
return wrap(t.identifier('arrayParser'));
166+
}
164167
return wrap(t.identifier('objectParser'));
165168
}
166169
}
@@ -278,6 +281,9 @@ function inject(t, list) {
278281
const adapterType = elt.typeAnnotation.typeParameters.params[0].id.name;
279282
type = `Adapter<${adapterType}>`;
280283
}
284+
if (type === 'StringOrStringArray') {
285+
type = 'String|String[]';
286+
}
281287
comments += ` * @property {${type}} ${elt.name} ${elt.help}\n`;
282288
const obj = t.objectExpression(props);
283289
return t.objectProperty(t.stringLiteral(elt.name), obj);

src/Options/Definitions.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ module.exports.ParseServerOptions = {
8383
env: 'PARSE_SERVER_ALLOW_ORIGIN',
8484
help:
8585
'Sets the origin to Access-Control-Allow-Origin. Can be a string for a single origin or a comma separated string or array for multiple',
86+
action: parsers.arrayParser,
8687
},
8788
analyticsAdapter: {
8889
env: 'PARSE_SERVER_ANALYTICS_ADAPTER',

src/Options/docs.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Options/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ type Adapter<T> = string | any | T;
3535
type NumberOrBoolean = number | boolean;
3636
type NumberOrString = number | string;
3737
type ProtectedFields = any;
38+
type StringOrStringArray = string | string[];
3839
type RequestKeywordDenylist = {
3940
key: string | any,
4041
value: any,
@@ -62,7 +63,7 @@ export interface ParseServerOptions {
6263
/* Add headers to Access-Control-Allow-Headers */
6364
allowHeaders: ?(string[]);
6465
/* Sets the origin to Access-Control-Allow-Origin. Can be a string for a single origin or a comma separated string or array for multiple */
65-
allowOrigin: ?(string | string[]);
66+
allowOrigin: ?StringOrStringArray;
6667
/* Adapter module for the analytics */
6768
analyticsAdapter: ?Adapter<AnalyticsAdapter>;
6869
/* Adapter module for the files sub-system */

0 commit comments

Comments
 (0)