如何通过在泊坞窗撰写文件emailAdapter论点解析服务器

问题描述 投票:0回答:1

我已经写定义解析服务器的码头工人,撰写文件。我想用默认mailgun适配器启用电子邮件验证。有人可以帮助我如何通过在撰写文件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":"[email protected]","apiKey":"mykey"}}
docker docker-compose parse-server
1个回答
1
投票

如果您使用的码头工人,最好的选择是使用配置模块。

配置模块作为command参数的最后一个参数传递。

你可以创建一个文件,在当前文件夹,命名为config.js有:

module.exports = {
  appId: "testApp",
  databaseURI: "....",
  emailAdapter: {"module":"@parse/simple-mailgun-adapter","options": /* ... */}
}

使用此,你将能够做到在您的码头工人,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为了添加日志,以确保其正常加载。

© www.soinside.com 2019 - 2024. All rights reserved.