Skip to content

laravel-zkconfig is a laravel configuration management tool

License

Notifications You must be signed in to change notification settings

lyuangg/laravel-zkconfig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

laravel-zkconfig

简体中文

laravel-zkconfig is a laravel configuration management tool. You can save some configuration information in zookeeper.

Instructions

Installation

composer require 'yuancode/laravel-zkconfig'

Publish configuration files

php artisan vendor:publish --provider="Yuancode\ZkConfig\ZkConfigServiceProvider" --tag=config

Add zk configuration

create /test/zkconfig '{"app.name": "test"}'

Modify the code

Modify the bootstrap/app.php file and add the following code under $app:

$app->afterBootstrapping(\Illuminate\Foundation\Bootstrap\LoadConfiguration::class, function ($app) {
     $zk = new \Yuancode\ZkConfig\Zk($app);
     $zk->loadZkConfig();
});

lumen

$app = new Laravel\Lumen\Application(
    dirname(__DIR__)
);

$zk = new \Yuancode\ZkConfig\Zk($app);
$zk->setHost('127.0.0.1:2181')    //zookeeper host
->setPath('/app/zkconfig/')       //config root path
->setCachePath(storage_path('zkconfig/config.json')) //config cache path
->setMode(\Yuancode\ZkConfig\Config::MODE_ENV)  //replace env variable
->setValType(\Yuancode\ZkConfig\Zk::VALUE_TYPE_KEY) //key,value mode
->loadZkConfig();  //load config

Available commands

Cache zk

php artisan zkconfig:server cache

Clean up the zk cache

php artisan zkconfig:server cache

Automatically update the zk cache

php artisan zkconfig:server start

About

laravel-zkconfig is a laravel configuration management tool

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages