parse-community / parse-server

Parse Server for Node.js / Express
https://parseplatform.org
Apache License 2.0
20.9k stars 4.78k forks source link

Parse Server option cannot be set via environment for interfaces #7151

Open mtrezza opened 3 years ago

mtrezza commented 3 years ago

New Issue Checklist

Issue Description

A Parse Server option cannot be set via environment variable if it is part of an interface. The reason seems to be that buildConfigDefinitions.js generates Definitions.js and adds the definitions for each interface into a separate module export. These definitions are then not part of module.exports.ParseServerOptions which seems to be the only export the Parse Server CLI considers.

Side note, that logic seems to be the reason why older Parse Server are all on the same root level and not grouped in nested objects, which is to consider for https://github.com/parse-community/parse-server/issues/7069.

Steps to reproduce

For example, idempotencyOptions has these sub keys:

idempotencyOptions: {
  paths: ...,
  ttl: ...,
}

The Definitions.js file only contains the root key PARSE_SERVER_EXPERIMENTAL_IDEMPOTENCY_OPTIONS in module.exports.ParseServerOptions. The CLI runner only imports module.exports.ParseServerOptions therefore, setting environment variable PARSE_SERVER_EXPERIMENTAL_IDEMPOTENCY_PATHS has no effect when initializing Parse Server.

Actual Outcome

All interfaces should be configurable via environment variables.

Expected Outcome

Only root key is configurable via environment variable.

Workaround

E.g. for idempotencyOptions the root key value can be set to an encoded object:

"PARSE_SERVER_EXPERIMENTAL_IDEMPOTENCY_OPTIONS": "{\"paths\":[\"functions/.*\"]}",

Failing Test Case / Pull Request

Environment

Server

Database

Client

Logs

mtrezza commented 3 years ago

I classified this issue as bug with severity S4: