laravel-streams / streams-core

Streams is an open-source web application engine for Laravel.
https://streams.dev
Other
169 stars 99 forks source link

StreamServiceProvider::registerConfig() probably not correct #739

Closed RobinRadic closed 1 year ago

RobinRadic commented 2 years ago

        $this->mergeConfigFrom(__DIR__ . '/../resources/config/core.php', 'streams.core');

        if (file_exists($config = __DIR__ . '/../../../../config/streams/core.php')) {
            $this->mergeConfigFrom($config, 'streams');
        }

        $this->publishes([
            __DIR__ . '/../resources/config/core.php' => config_path('streams/core.php'),
        ], 'config');

I'll go over each line of code;

$this->mergeConfigFrom(__DIR__ . '/../resources/config/core.php', 'streams.core'); Perfect. It merges config relative to the current class.


if (file_exists($config = __DIR__ . '/../../../../config/streams/core.php')) {
    $this->mergeConfigFrom($config, 'streams');
}
```php
This seems to be a attempt to load config from the root `config` folder. This already is done by the bootstrapper which recursively works. The namespace is off aswell. This is the line i think needs to be removed. Once the config file is published to `config/streams/core.php` the bootstrapper will load the `config` folder.  any config file inside a folder will be getting prefixed with the folders name in the eventual config array.

Suggestion: remove line
RyanThompson commented 1 year ago

Could have just removed the lines! Lmao. Noted/removed.