Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config files aren't discovered automatically when using the config() function. #1293

Closed
bvrignaud opened this issue Oct 4, 2018 · 2 comments

Comments

@bvrignaud
Copy link
Contributor

I'm actually porting the Ion-Auth (3) to CI4.
You can have look to the wip here : https://github.com/bvrignaud/CodeIgniter-Ion-Auth/tree/4.
I'm based on Code Modules documentation.

As the documentation explain :

Config files are automatically discovered whenever using the config() function that is always available.

I have a config file in my module_directory/Config.
In my library / model / controller, I'm trying to load my config file with config('IonAuth')
But it can't be load.
It works only if I put my config file in application/Config.

Thanks

CodeIgniter 4 version
The last develop version

Context

  • OS: LMDE 3
  • Web server : Apache on docker
  • PHP version : 7.1
@lonnieezell
Copy link
Member

Where does the namespace point to? The way the scanning works is to look at the directory the namespace represents, like Modules/IonAuth and look for Config/{file}.php there. In this case that would be Modules/IonAuth/Config/{file}.php

If you including the package through Composer, the namespace would still have to be defined in application/Config/Autoload.php to work.

@bvrignaud
Copy link
Contributor Author

I think I hadn't understood well the documentation.
As you can see, I had code it like this : bvrignaud/CodeIgniter-Ion-Auth@72509bf
My first idea was to make something like this and if the final developer want to configure special settings, he have to duplicate the config file in the application/Config directory. And that doesn't works.
But, as I saw, we can set settings in .env file. So It's Ok.

Sorry for the inconvenience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants