如何在 docker compose 文件中为解析服务器传递 emailAdapter 参数
How to pass emailAdapter arguments in docker compose file for parse-server
我有一个 docker 撰写文件来定义解析服务器。我想使用默认的 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":"sandbox@mailgun.com","apiKey":"mykey"}}
如果您使用 docker,最好的选择是使用配置模块。
配置模块作为 command
参数的最后一个参数传递。
您可以在当前文件夹中创建一个名为 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 撰写文件来定义解析服务器。我想使用默认的 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":"sandbox@mailgun.com","apiKey":"mykey"}}
如果您使用 docker,最好的选择是使用配置模块。
配置模块作为 command
参数的最后一个参数传递。
您可以在当前文件夹中创建一个名为 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 中添加日志以确保它已正确加载。