mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-25 17:45:34 +08:00
update to 2.0.0-b7 version
fix environment getter
This commit is contained in:
@@ -7,6 +7,7 @@ use Symfony\Component\Console\Command\Command;
|
|||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
use ZM\Config\ZMConfig;
|
||||||
use ZM\Framework;
|
use ZM\Framework;
|
||||||
|
|
||||||
class RunServerCommand extends Command
|
class RunServerCommand extends Command
|
||||||
@@ -37,10 +38,11 @@ class RunServerCommand extends Command
|
|||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output) {
|
protected function execute(InputInterface $input, OutputInterface $output) {
|
||||||
if(($opt = $input->getOption("env")) !== null) {
|
if(($opt = $input->getOption("env")) !== null) {
|
||||||
if(!in_array($opt, ["production", "staging", "development"])) {
|
if(!in_array($opt, ["production", "staging", "development", ""])) {
|
||||||
$output->writeln("<error> \"--env\" option only accept production, development and staging ! </error>");
|
$output->writeln("<error> \"--env\" option only accept production, development, staging and [empty] ! </error>");
|
||||||
return Command::FAILURE;
|
return Command::FAILURE;
|
||||||
}
|
}
|
||||||
|
ZMConfig::setEnv($opt);
|
||||||
}
|
}
|
||||||
// ... put here the code to run in your command
|
// ... put here the code to run in your command
|
||||||
// this method must return an integer number with the "exit status code"
|
// this method must return an integer number with the "exit status code"
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class ConsoleApplication extends Application
|
|||||||
}
|
}
|
||||||
|
|
||||||
ZMConfig::setDirectory(DataProvider::getWorkingDir() . '/config');
|
ZMConfig::setDirectory(DataProvider::getWorkingDir() . '/config');
|
||||||
ZMConfig::env($args["env"] ?? "");
|
ZMConfig::setEnv($args["env"] ?? "");
|
||||||
if (ZMConfig::get("global") === false) {
|
if (ZMConfig::get("global") === false) {
|
||||||
echo ("Global config load failed: " . ZMConfig::$last_error."\nPlease init first!\n");
|
echo ("Global config load failed: " . ZMConfig::$last_error."\nPlease init first!\n");
|
||||||
$this->add(new InitCommand());
|
$this->add(new InitCommand());
|
||||||
|
|||||||
@@ -94,7 +94,6 @@ class Response
|
|||||||
*/
|
*/
|
||||||
public function status($http_code, $reason = null) {
|
public function status($http_code, $reason = null) {
|
||||||
$this->status_code = $http_code;
|
$this->status_code = $http_code;
|
||||||
Console::trace();
|
|
||||||
return $this->response->status($http_code, $reason);
|
return $this->response->status($http_code, $reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user