コマンドラインからの非対話的 SiteSetting 変更

移行スクリプトを作成中で、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!