- Begin work on firewall

This commit is contained in:
Dave M. 2023-11-17 23:35:56 -05:00
parent e78ee3a458
commit 55f5071475
4 changed files with 28 additions and 6 deletions

View File

@ -6,4 +6,15 @@ return [
getenv('DEBUG') ? 'lean.console' : null,
]
],
'ulmus' => [
'connections' => [
'lean.console' => [
'adapter' => 'SQLite',
'path' => getenv('PROJECT_PATH') . DIRECTORY_SEPARATOR . "var/lean-console.sqlite3",
'pragma_begin' => array_filter([ "foreign_keys=ON", "synchronous=NORMAL", getenv('DEBUG') ? "journal_mode=WAL" : "" ]),
'pragma_close' => [ "analysis_limit=500", "optimize" ],
],
],
],
];

View File

@ -24,7 +24,11 @@ return [
],
],
'ulmus' => [],
'ulmus' => [
'entities' => [
'Lean\\Console\\Entity\\Firewall' => implode(DIRECTORY_SEPARATOR, [ $path , "src", "Entity", "Firewall" ]),
],
],
'tell' => [
'json' => [
@ -35,7 +39,7 @@ return [
]
],
'routes' => [
'routes' => ! getenv('DEBUG') ? [] : [
'Lean\\Console\\Controller' => implode(DIRECTORY_SEPARATOR, [ $path, "src", "Controller", "" ]),
],
],

View File

@ -11,7 +11,7 @@ use function DI\autowire, DI\create, DI\get;
return [
'console.adapter' => function($c) {
$adapter = new ConnectionAdapter('sqlite', $c->get('config')['ulmus'], true);
$adapter = new ConnectionAdapter('lean.console', $c->get('config')['ulmus'], false);
$adapter->resolveConfiguration();
return $adapter;

View File

@ -4,10 +4,13 @@ namespace Lean\Console\Entity\Firewall;
use Ulmus\Attribute\Obj\Table;
use Ulmus\Attribute\Property\Field;
use Ulmus\Entity\Field\Datetime;
#[Table(adapter: "lean.console")]
class Connection
#[Table(name:"firewall_connections", adapter: "lean.console")]
class Connection implements \JsonSerializable
{
use \Ulmus\EntityTrait;
#[Field\Id]
public string $id;
@ -18,7 +21,11 @@ class Connection
public string $ipv6;
#[Field]
public int $connectionTry = 0;
public bool $success;
#[Field(length: 255)]
public ? string $errorMessage;
#[Field\Datetime]
public Datetime $createdAt;
}