简体   繁体   中英

How to pass emailAdapter arguments in docker compose file for parse-server

I have a docker compose file written to define parse-server. I want to enable email verification using the default mailgun adapter. Can someone help me how to pass the emailAdapter arguments in the compose file ?

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

I tried passing this argument but this did not work

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

If you are using docker, the best option is to use a configuration module.

The configuration module is passed as the last argument for the command parameter.

You can create a file, in your current folder, named config.js with:

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

Using this you will be able to do the following in your 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

This should now load your app properly.

You can add logs in the config.js in order to make sure it is properly loaded.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM