I configured a logo in the site settings, but the logo’s URL is missing the default port, i.e. the logo URL looks like this http://localhost/uploads/… rather than http://localhost:3000/uploads/….
I’m starting the development server like this:
RAILS_ENV=development bundle exec rails server
I found that Discourse.base_url is set to "http://localhost" and in config/database.yml, I find this note for the development.hostnames key:
### Don't include the port number here.
Change the "port" site setting instead, at /admin/site_settings.
However, such a site setting does not exist. What do I do?
It’s the default, though, isn’t it? That one has to set the hidden port setting is not at all obvious, hence seeing a logo in the development environment not load is unexpected. In other words, setting a custom logo should just work.
واجهتُ المشكلة المعاكسة لما ذكره المنشئ الأصلي عند إعداد موقع تطويري أمس: كنتُ أشغّل خادم التطوير خلف وكيل Nginx، لذا كنتُ أرغب في عناوين URL نظيفة، لكن بغضّ النظر عن التغييرات التي أجريتها في الإعدادات، كان Discourse يضيف :3000 إلى العديد من الروابط الداخلية الخاصة بي، بما في ذلك شعار الموقع. وقد تمكّنتُ في النهاية من تتبع المشكلة إلى الأسطر من 291 إلى 293 في ملف lib/discourse.rb:
if Rails.env.development? && SiteSetting.port.blank?
url << ":#{ENV["UNICORN_PORT"] || 3000}"
end
عند تعليق هذه الأسطر، عمل الشعار والروابط الأخرى بشكل صحيح، رغم أنني لا أعرف ما إذا كان ذلك قد يؤدي إلى مشاكل أخرى في المستقبل. ويبدو أن تجاوز SiteSetting.port بهذه الطريقة غير بديهي إلى حد ما.
لقد جربت هذا قليلاً أكثر، ويبدو أن كل شيء يعمل بشكل صحيح فعليًا إذا قمت فقط بتعيين SiteSetting.port = 443 وأيضًا تحديد المربع لـ ‘فرض https’ (وأعتقد أنه سيعمل أيضًا مع المنفذ 80 وبدون https). لقد قرأت في مكان ما أنه يجب أن أترك إعدادات المنفذ فارغة، لكن يبدو أن ذلك كان نصيحة سيئة.