Welcome Guest, Not a member yet? Register   Sign In
Using a .yml (or other file) to dynamically assign config.php values
#1

I got some experience in Symfony, and i am used to being able to fill in config values after the first composer install command, and since CI supports some Symfony modules, i guessed it would be possible here as well. Thing is, i can't call the Yaml library in the config file, and editing it after the file is loaded is hardly recommended. 

I imagine there must be some way to use a yml, json or xml file to externally load in configuration settings that have been defined in a composer install/update command. If there are any other ways that i can easily manage my project so that people can pull in the git and during installation go through the configs without having to edit the config files themselves, that would be nice.
Reply
#2

Codeigniter stops you from opening the file unless the BASEPATH is set from index.php

See the index.html file in the config folder look at it.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(10-18-2018, 03:00 AM)InsiteFX Wrote: Codeigniter stops you from opening the file unless the BASEPATH is set from index.php

See the index.html file in the config folder look at it.

Honestly, did not think of that. I will need to put the file in a defined folder then. But even so, even if i make a XML file and load it in (arguably easier than a .yml), i still have to be able to generate that file from within a composer install/update command. As far as things are looking now, i'd have to write my own composer package that asks for the settings and generates a paramaters.xml for me, as i cannot find one that does that already.

Problem still is, that it is not recommended to have logic in the config.php, and sure i can write a controller that is called before the .xml is applied, and edits the config.php for me, but that still forces the developer to run the page at least once while it is not configured, and that feels like a step that can be avoided. Also, it does not make sense to do it this way for people who are used to CI.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB