This commit is contained in:
2026-05-06 19:36:53 +03:00
parent 43dd36e20e
commit 8b3a3964a5
10 changed files with 48 additions and 45 deletions
+3 -2
View File
@@ -4,7 +4,8 @@ namespace Lucent\Channel;
use Lucent\Channel\Data\UserCommand;
use Lucent\Primitive\Collection;
use Lucent\Schema\Schema;
use Lucent\Data\Schema;
use Lucent\Data\ChannelAuth;
final class Channel
{
@@ -18,6 +19,7 @@ final class Channel
*/
function __construct(
public string $name,
public ChannelAuth $auth,
public string $url,
public string $previewTarget,
public Collection $commands,
@@ -27,7 +29,6 @@ final class Channel
) {
$this->lucentUrl = $url . "/lucent";
$this->filesUrl = $this->makeFilesUrl();
$this->previewTargetUrl = $url . "/" . $previewTarget;
}
+5
View File
@@ -3,6 +3,7 @@
namespace Lucent\Channel;
use Lucent\Channel\Data\UserCommand;
use Lucent\Data\ChannelAuth;
use Lucent\Primitive\Collection;
use Lucent\Data\Schema;
use Lucent\Schema\SchemaService;
@@ -34,6 +35,10 @@ final class ChannelService
$channel = new Channel(
name: config("lucent.name") ?? "",
auth: match (config("lucent.auth")) {
"lunar" => ChannelAuth::LUNAR,
default => ChannelAuth::LUCENT,
},
url: rtrim(config("lucent.url") ?? "", "/"),
previewTarget: rtrim(config("lucent.previewTarget") ?? "", "/"),
commands: Collection::make($userCommands),
+5 -4
View File
@@ -2,10 +2,11 @@
return [
"env" => env("LUCENT_ENV", "production"),
"auth" => env("LUCENT_AUTH", "lucent"),
"schemas_path" => env("LUCENT_SCHEMAS_PATH", "resources/lucent/schemas"),
"database" => env('LUCENT_DB_CONNECTION', env('DB_CONNECTION', "sqlite")),
"database" => env("LUCENT_DB_CONNECTION", env("DB_CONNECTION", "sqlite")),
"name" => env("LUCENT_NAME", "Lucent"),
"url" => env("LUCENT_URL", env('APP_URL')),
"url" => env("LUCENT_URL", env("APP_URL")),
"previewTarget" => env("LUCENT_PREVIEW_TARGET", "previewTarget"),
/*
* Make available laravel artisan commands for admin users
@@ -44,6 +45,6 @@ return [
\Lucent\Schema\Ui\Rich::class,
\Lucent\Schema\Ui\Slug::class,
\Lucent\Schema\Ui\Text::class,
\Lucent\Schema\Ui\Textarea::class
]
\Lucent\Schema\Ui\Textarea::class,
],
];
+9
View File
@@ -0,0 +1,9 @@
<?php
namespace Lucent\Data;
enum ChannelAuth: string
{
case LUNAR = "lunar";
case LUCENT = "lucent";
}
+7 -4
View File
@@ -10,16 +10,16 @@ use Intervention\Image\ImageManager;
use Lucent\Account\AuthService;
use Lucent\Account\AuthServiceLunar;
use Lucent\Account\UserRepo;
use Lucent\Account\UserRepoLucent;
use Lucent\Account\UserRepoLunar;
use Lucent\Channel\ChannelService;
use Lucent\Commands\CompileSchemas;
use Lucent\Commands\GenerateCollectionSchema;
use Lucent\Commands\GenerateFileSchema;
use Lucent\Commands\LiveLink;
use Lucent\Commands\RebuildThumbnails;
use Lucent\Commands\RemoveOrphanEdges;
use Lucent\Commands\SetupDatabase;
use Lucent\Commands\UpgradeFiles122;
use Lucent\Data\ChannelAuth;
use Lucent\File\FileService;
use Lucent\Query\DatabaseGraph\DatabaseGraph;
use Lucent\Query\DatabaseGraph\PgsqlDatabaseGraph;
@@ -43,8 +43,11 @@ class LucentServiceProvider extends ServiceProvider
return new PgsqlDatabaseGraph();
});
$this->app->bind(UserRepo::class, function () {
return new UserRepoLunar();
$this->app->bind(UserRepo::class, function ($app) {
return match ($app->make(ChannelService::class)->channel->auth) {
ChannelAuth::LUNAR => new UserRepoLunar(),
ChannelAuth::LUCENT => new UserRepoLucent(),
};
});
$this->app->bind(AuthService::class, function ($app) {