هل ترغب في تقديم ملف ثابت في الجذر من خادم Discourse؟
إليك ما يجب فعله. في أسفل ملف app.yml، في قسم الأوامر المخصصة، قم بما يلي:
## تذكر، هذا هو تركيب YAML - لا يمكنك إلا أن يكون لديك كتلة واحدة باسم
run:
- exec: echo "Beginning of custom commands"
- file:
path: /var/www/discourse/public/myfile.txt
chmod: "+r"
contents: |
Stuff that's in the file goes here.
- exec: echo "End of custom commands"
Personally i find this really useful. Not to mention that this kind of static file, gives you way more opportunities to use your imagination, files, maybe other website service that you can run as static – etc
I imagine simple text strings work well enough, though I also imagine for this to be more useful, markup, links, images, etc. would be desired. I suspect that the more closely “stuff” approaches being a web page the more difficult it would be to not break.
@pfaffman what is your use case and what degree of complexity have you been able to do successfully?
Well, you’ve seen the actual examples that I know about. There are ways not to need it, but I’ve wanted to do this a few times and finally bothered to figure it out.
مثير للاهتمام ومفيد جدًا. هل يمكن تعديله للسماح بإسقاط العديد من الملفات في مجلد للوصول إليها؟ على سبيل المثال، إذا أردت إنشاء /var/www/discourse/public/img بحيث يمكن تقديم yourserver.tld/img/step_1.png بسهولة، وأي عدد من الملفات اللاحقة التي يتم نسخها عبر scp أو رفعها بطريقة ما إلى الخادم؟