Skip to content

Commit

Permalink
Merge pull request #21
Browse files Browse the repository at this point in the history
Improved stability
  • Loading branch information
leonardosahon authored Dec 30, 2023
2 parents 3c53475 + aa58e8c commit 4ceae52
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/BobDBuilder/Cmd/Traits/Make/Domain.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ public function domain(): void
$this->talk("- Linking shared directory *{$this->plug->server->shared}*");
new BobExec("link:dir web{$this->plug->s}shared web{$this->plug->s}domains{$this->plug->s}$domain{$this->plug->s}shared --silent");

$this->talk("- Linking Api domain to new domain *{$this->plug->server->domains}Api*");
new BobExec("link:dir web{$this->plug->s}domains{$this->plug->s}Api web{$this->plug->s}domains{$this->plug->s}$domain{$this->plug->s}api --silent");

$this->talk("- Updating domains entry in *{$this->plug->server->web}index.php*");
$this->update_general_domain_entry($domain, $domain_id, $pattern);
}
Expand Down
7 changes: 3 additions & 4 deletions src/Core/Api/ApiEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use BrickLayer\Lay\Core\Api\Enums\ApiRequestMethod;
use BrickLayer\Lay\Core\Exception;

// TODO: Implement Middleware Handler
final class ApiEngine {
public static function new() : self {
return new self();
Expand Down Expand Up @@ -40,7 +39,7 @@ private function correct_request_method(bool $throw_exception = true) : bool {
self::exception(
"UnmatchedRequestMethod",
"Request method for api request [". self::$request_uri_raw ."]; don't match.
Check if you have binded you route to a method, it could be using the method of the previous route"
Check if you have bound you route to a method, it could be using the method of the previous route"
);

return false;
Expand Down Expand Up @@ -268,16 +267,16 @@ public function print_as_json(bool $print = true) : string|bool|null {
$x = json_encode(self::$method_return_value);

if($print) {
print_r($x);
header("Content-Type: application/json");
print_r($x);
die;
}

return $x;
}

/**
* Get the mapped out arguments of a current `->for` case
* Get the mapped-out arguments of a current `->for` case
* @return array
*/
public function get_mapped_args() : array {
Expand Down
3 changes: 3 additions & 0 deletions src/Core/Traits/Init.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
trait Init {
private static string $dir;
private static string $base;
private static string $proto;
private static string $base_no_proto;
private static string $base_no_proto_no_www;
private static string $env_host;
Expand All @@ -25,6 +26,7 @@ private static function init_first_class() : void {
private static function set_web_root(&$options) : void
{
$options['base'] = self::$base;
$options['proto'] = self::$proto;
$options['base_no_proto'] = self::$base_no_proto;
$options['base_no_proto_no_www'] = self::$base_no_proto_no_www;

Expand Down Expand Up @@ -93,6 +95,7 @@ private static function first_class_citizens() : void {
if($http_host != "cli")
self::$LAY_MODE = LayMode::HTTP;

self::$proto = $proto;
self::$base = $proto . $http_host . $base_no_proto . "/";
self::$base_no_proto = $http_host . $base_no_proto;
self::$base_no_proto_no_www = str_replace("www.","", $base_no_proto);
Expand Down
1 change: 1 addition & 0 deletions src/Core/Traits/Resources.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public static function server_data() : object

#[ObjectShape([
"base" => 'string',
"proto" => 'string',
"base_no_proto" => 'string',
"base_no_proto_no_www" => 'string',
"domain" => 'string',
Expand Down

0 comments on commit 4ceae52

Please sign in to comment.