use variable in ini file

70 views
Skip to first unread message

v.

unread,
Sep 27, 2019, 4:37:44 AM9/27/19
to Fat-Free Framework
Hi,
I was wondering how to use a previously defined variable in the ini file.
Eg.:
currently I have this set up in my config.ini:

AUTOLOAD=app/controllers/|app/models/
UI=app/views/
LOG_DIR=app/log/

I want to change this to

APPDIR=app/
AUTOLOAD=APPDIR.controllers/ | APPDIR.models/
UI=APPDIR.views/
LOG_DIR=APPDIR.log/

This does not seem to work.
Also this seems to be failing:
AUTOLOAD={{ @APPDIR }}controllers/
...

Is it possible to use a variable in the config file?

Vlad Sidorov

unread,
Sep 27, 2019, 7:44:08 AM9/27/19
to Fat-Free Framework
See https://fatfreeframework.com/3.6/base#config

Use Base::instance->config('config-file.ini', true);

If the 2nd argument  is TRUE, template strings are interpreted, thus making dynamic configs possible.

Ex.:
APPDIR=app/
AUTOLOAD={{ @APPDIR }}controllers/

пятница, 27 сентября 2019 г., 11:37:44 UTC+3 пользователь v. написал:

v.

unread,
Sep 27, 2019, 4:53:58 PM9/27/19
to Fat-Free Framework
I had no idea you could do that!
*mind is blown*
Thanks, works like a charm!

JoséRené Barnéond

unread,
Sep 27, 2019, 5:30:25 PM9/27/19
to v. via Fat-Free Framework, Fat-Free Framework
Is there an official wiki? we should be adding this random super awesome tips somewhere
José René Barnéond


--
-- You've received this message because you are subscribed to the Google Groups group. To post to this group, send an email to f3-fra...@googlegroups.com. To unsubscribe from this group, send an email to f3-framework...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/f3-framework?hl=en
---
You received this message because you are subscribed to the Google Groups "Fat-Free Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to f3-framework...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/f3-framework/3ef3e33a-51f6-440b-8f43-ac55741f1d8a%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages