我正在编写一个迁移脚本,想要通过编程方式设置 s3_upload_bucket 站点设置。我找到了一个在 Docker 实例内部设置它的方法:
echo 'SiteSetting.s3_upload_bucket="mybucket"' | bundle exec rails c
但后者包含管道符,因此将其与 docker exec -it app <command> 链式使用时会导致错误。
有办法解决这个问题吗?
提前感谢。
我正在编写一个迁移脚本,想要通过编程方式设置 s3_upload_bucket 站点设置。我找到了一个在 Docker 实例内部设置它的方法:
echo 'SiteSetting.s3_upload_bucket="mybucket"' | bundle exec rails c
但后者包含管道符,因此将其与 docker exec -it app <command> 链式使用时会导致错误。
有办法解决这个问题吗?
提前感谢。
Just add that SiteSetting like to your importer. I’ve added similar code to disable outgoing mail to several importers. You can help grep the importer directory for "Site* for examples.
I found the solution!
echo "SiteSetting.sso_url='newurl'" | docker exec -w /var/www/discourse -i app bundle exec rails c
I’m not clear what kind of migration script you’re writing. I do then in ruby and it’s easy to change site settings there.
This is a great trick, though!