如何在docker compose文件中为解析服务器传递emailAdapter参数

如何在docker compose文件中为解析服务器传递emailAdapter参数,docker,docker-compose,parse-server,Docker,Docker Compose,Parse Server,我编写了一个docker compose文件来定义解析服务器。我想使用默认的mailgun适配器启用电子邮件验证。 有人能帮助我如何在compose文件中传递emailAdapter参数吗 my-parse-server: depends_on: - my-mongo container_name: "my-parser-server" image : parseplatform/parse-server:latest links: - my-mongo:mongo command:

我编写了一个docker compose文件来定义解析服务器。我想使用默认的mailgun适配器启用电子邮件验证。 有人能帮助我如何在compose文件中传递emailAdapter参数吗

my-parse-server: 
depends_on:
  - my-mongo 
container_name: "my-parser-server"
image : parseplatform/parse-server:latest
links:
  - my-mongo:mongo
command: '--appId testapp 
          --masterKey mykey 
          --databaseURI mongodb://mongo/test 
          --emailVerifyTokenValidityDuration 2*60*60 
          --preventLoginWithUnverifiedEmail true
          --appName myApp
          --emailAdapter ????'
environment:
  VERBOSE: "1"
  PARSE_SERVER_VERIFY_USER_EMAILS: "true"
  PARSE_PUBLIC_SERVER_URL: "localhost"
ports:
  - 1337:1337
我试图通过这个论点,但没有成功

--emailAdapter {"module":"@parse/simple-mailgun-adapter","options":{"fromAddress":"mail@mailgun","domain":"sandbox@mailgun.com","apiKey":"mykey"}}

如果您使用的是docker,最好的选择是使用配置模块

配置模块作为
命令
参数的最后一个参数传递

您可以在当前文件夹中创建一个名为
config.js
的文件,其中包括:

module.exports = {
  appId: "testApp",
  databaseURI: "....",
  emailAdapter: {"module":"@parse/simple-mailgun-adapter","options": /* ... */}
}
使用此选项,您将能够在docker-compose.yml中执行以下操作

my-parse-server: 
depends_on:
  - my-mongo 
container_name: "my-parser-server"
image : parseplatform/parse-server:latest
links:
  - my-mongo:mongo
command:  --masterKey mykey 
          --emailVerifyTokenValidityDuration 2*60*60 
          --preventLoginWithUnverifiedEmail true
          --appName myApp
          /config/config.js
volume: ./:/config
environment:
  VERBOSE: "1"
  PARSE_SERVER_VERIFY_USER_EMAILS: "true"
  PARSE_PUBLIC_SERVER_URL: "localhost"
ports:
  - 1337:1337
这将正确加载你的应用程序


您可以在config.js中添加日志,以确保它已正确加载。

我使用的是docker compose版本3,它与以下卷一起工作:-./config:/confignice!添加到文档或示例folderYes中的主回购将非常棒。是的,我在文档中找不到此信息。我正在使用docker官方图片制作一个compose文件,以加速开发环境。我将很快与大家分享这个例子。我不久前就做了,这非常简单。我总是对数据库保持警惕,从本地开发到远程开发等等。。。