Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
569 views
in Q2A Core by
Hi,

I would like to have some configuration settings in files, so that I can deploy a new q2a page with my default configuration settings, without having to go to the admin panel and manually configure them. Is there a solution available for this already, which I have missed?

If not, I suppose I have to write some code which reads my configuration files, and then modifies the database with the configuration settings? Maybe as a plugin?

If this sounds like the way to go, I would really appreciate some start-up help! A few pointers, an example, that sort of thing.

Thanks in advance!

1 Answer

+2 votes
by
selected by
 
Best answer

Is there a solution available for this already, which I have missed? 

No, there is not.

If not, I suppose I have to write some code which reads my configuration files, and then modifies the database with the configuration settings? Maybe as a plugin?

No. You don't have to necessarily access the DB directly but you can. You don't necessarily have to use a plugin but you can too. You could just write your script using the info in this link: http://docs.question2answer.org/code/external/ . Then just call qa_opt to set the settings.

by
Thanks! This sounds much better than going directly to the db. However, I tried to use the first of those examples, but I fail, due to incompetence as it seems...

At first, my "Require once" path was incorrect and there were loud protest when executing the script. After fixing it though, everything is dead silent. Regardless if I run form a browser or command line. I'm sure I'm missing something super fundamental here, so pardon my ignorance!
by
Well, there isn't much to miss here as they're just a few lines.  You need to check at what point execution dies. Most likely the web server's error log will help on that and blame the right line. That is essential for developing Q2A.

Additionally, you can add "echo 1;" before the first require and "echo 2;" before the second statement and so on. Then see at what point execution dies. That should give you a hint in case the web server's logs aren't clear.
by
Thanks again! I did some echo-debugging like you suggested, and got the examples to work.
...