-
Notifications
You must be signed in to change notification settings - Fork 47
Subdomains CNAME support #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
26da256
3095fcc
9a25084
a26708e
fd92b44
cc84b6e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| <?php | ||
|
|
||
| use Illuminate\Database\Migrations\Migration; | ||
| use Illuminate\Database\Schema\Blueprint; | ||
| use Illuminate\Support\Facades\Schema; | ||
|
|
||
| return new class extends Migration | ||
| { | ||
| public function up(): void | ||
| { | ||
| Schema::table('nodes', function (Blueprint $table) { | ||
| $table->renameColumn('srv_target', 'subdomain_target'); | ||
| }); | ||
| } | ||
|
|
||
| public function down(): void | ||
| { | ||
| Schema::table('nodes', function (Blueprint $table) { | ||
| $table->renameColumn('subdomain_target', 'srv_target'); | ||
| }); | ||
| } | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| <?php | ||
|
|
||
| namespace Boy132\Subdomains\Enums; | ||
|
|
||
| use App\Models\Server; | ||
| use Filament\Support\Contracts\HasLabel; | ||
|
|
||
| enum RecordType: string implements HasLabel | ||
| { | ||
| case A = 'A'; | ||
| case AAAA = 'AAAA'; | ||
| case CNAME = 'CNAME'; | ||
| case SRV = 'SRV'; | ||
|
|
||
| public function getLabel(): string | ||
| { | ||
| return $this->name; | ||
| } | ||
|
|
||
| /** | ||
| * @return array<string> | ||
| */ | ||
| public static function availableRecordTypes(Server $server): array | ||
| { | ||
| if (!$server->allocation) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CNAME doesn't require an allocation, so that should be available. |
||
| return []; | ||
| } | ||
|
|
||
| $types = []; | ||
|
|
||
| if (!in_array($server->allocation->ip, ['0.0.0.0', '::'])) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Allocations with
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not understand why SRV and CNAME records should be blocked while having an invalid allocation. The values are never used in the created records, since they only use Subdomain target. If the user has a working install where they use 0.0.0.0 on nodes, and can create Subdomain target to route to server correctly, I think we should allow them to create SRV and CNAME records. I think we should keep restrictions here as open as functionally possible and let the user deal with ensuring everything outside wings routes correctly.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because I have a personal vendetta against
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah yes, of course. I am still not a fan of this logic. Since having
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Boy132 Additionally, if you insist on blocking all subdomain types for 0.0.0.0, including CNAME, then this PR will NOT close #79. |
||
| if (is_ipv6($server->allocation->ip)) { | ||
| $types[self::AAAA->name] = self::AAAA->value; | ||
| } else { | ||
| $types[self::A->name] = self::A->value; | ||
| } | ||
| } | ||
|
|
||
| // @phpstan-ignore property.notFound | ||
| if ($server->node->subdomain_target) { | ||
| $types[self::CNAME->name] = self::CNAME->value; | ||
| $types[self::SRV->name] = self::SRV->value; | ||
| } | ||
|
|
||
| return $types; | ||
| } | ||
| } | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <?php | ||
|
|
||
| namespace Boy132\Subdomains\Filament\Admin\Resources\SubdomainTargets\Pages; | ||
|
|
||
| use Boy132\Subdomains\Filament\Admin\Resources\SubdomainTargets\SubdomainTargetResource; | ||
| use Filament\Resources\Pages\ManageRecords; | ||
|
|
||
| class ManageSubdomainTargets extends ManageRecords | ||
| { | ||
| protected static string $resource = SubdomainTargetResource::class; | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.