onecentlin / laravel-adminer

Adminer database manager for Laravel 5+
MIT License
243 stars 45 forks source link

Disable adminer in several environments #19

Closed huszerldani closed 2 years ago

huszerldani commented 2 years ago

Added an env variable for enabling/disabling adminer. It is useful for a production environment.

huszerldani commented 2 years ago

Hi! I really like your package, but I need to disable it in production environment, so I made an env variable called ADMINER_ENABLED with default false.

inmanturbo commented 2 years ago

Hi @huszerldani

This package does not automatically register its provider. One thing thing you can do in the meantime is conditionally register it. I'm using the following in a few projects:

/** 
* Register any application services. 
* 
* @return void 
*/ 
public function register() 
{ 
    // register adminer but only in local environment     

if($this->app->environment(['local', 'dev'])) { 
        $this->app->register(\Onecentlin\Adminer\ServiceProvider::class); 
    } 
}
inmanturbo commented 2 years ago

Hi @huszerldani

This package does not automatically register its provider. One thing thing you can do in the meantime is conditionally register it. I'm using the following in a few projects:

/** 
* Register any application services. 
* 
* @return void 
*/ 
public function register() 
{ 
    // register adminer but only in local environment     if($this->app->environment(['local', 'dev'])) { 
        $this->app->register(\Onecentlin\Adminer\ServiceProvider::class); 
    } 
}

Sorry about the formatting. Posting from my phone atm

huszerldani commented 2 years ago

Thank you! 🙏