from masonite.facades import Config
class MyPackageServiceProvider(Provider):
def register(self):
Config.merge_with("mypackage", abspath("mypackage/config.py"))
# or
Config.merge_with("mypackage", "masonite.mypackage.config")
The function takes a file path or a module dotted path (whatever) and is loading parameters inside the module. Then it's overriden with eventual config for mypackage found in the project dir.
An exception will be raised if we try to use this for config (application, auth, ...).
Summary
If a Masonite package is installed in your project and the package service provider is using Config.merge_with:
without publishing config file to the project, the package configuration will be accessible at config("mypackage.param").
if the config is published to the project, the package configuration will be accessible at config("mypackage.param") and project parameters will take precedence over package default parameters.
SHOULD BE MERGED ONCE #147 is merged !
In a package service provider we can do:
The function takes a file path or a module dotted path (whatever) and is loading parameters inside the module. Then it's overriden with eventual config for
mypackage
found in the project dir.An exception will be raised if we try to use this for config (
application
,auth
, ...).Summary
If a Masonite package is installed in your project and the package service provider is using
Config.merge_with
:config("mypackage.param")
.config("mypackage.param")
and project parameters will take precedence over package default parameters.This will be useful for #79.