feat: support Hetzner S3
This commit is contained in:
		@@ -43,15 +43,17 @@ class Create extends Component
 | 
				
			|||||||
        'endpoint' => 'Endpoint',
 | 
					        'endpoint' => 'Endpoint',
 | 
				
			||||||
    ];
 | 
					    ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function mount()
 | 
					    public function updatedEndpoint($value)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if (isDev()) {
 | 
					        if (! str($value)->startsWith('https://') && ! str($value)->startsWith('http://')) {
 | 
				
			||||||
            $this->name = 'Local MinIO';
 | 
					            $this->endpoint = 'https://'.$value;
 | 
				
			||||||
            $this->description = 'Local MinIO';
 | 
					            $value = $this->endpoint;
 | 
				
			||||||
            $this->key = 'minioadmin';
 | 
					        }
 | 
				
			||||||
            $this->secret = 'minioadmin';
 | 
					
 | 
				
			||||||
            $this->bucket = 'local';
 | 
					        if (str($value)->contains('your-objectstorage.com') && ! isset($this->bucket)) {
 | 
				
			||||||
            $this->endpoint = 'http://coolify-minio:9000';
 | 
					            $this->bucket = str($value)->after('//')->before('.');
 | 
				
			||||||
 | 
					        } elseif (str($value)->contains('your-objectstorage.com')) {
 | 
				
			||||||
 | 
					            $this->bucket = $this->bucket ?: str($value)->after('//')->before('.');
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,6 +8,7 @@ function set_s3_target(S3Storage $s3)
 | 
				
			|||||||
    $is_digital_ocean = false;
 | 
					    $is_digital_ocean = false;
 | 
				
			||||||
    if ($s3->endpoint) {
 | 
					    if ($s3->endpoint) {
 | 
				
			||||||
        $is_digital_ocean = Str::contains($s3->endpoint, 'digitaloceanspaces.com');
 | 
					        $is_digital_ocean = Str::contains($s3->endpoint, 'digitaloceanspaces.com');
 | 
				
			||||||
 | 
					        $is_hetzner = Str::contains($s3->endpoint, 'your-objectstorage.com');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    config()->set('filesystems.disks.custom-s3', [
 | 
					    config()->set('filesystems.disks.custom-s3', [
 | 
				
			||||||
        'driver' => 's3',
 | 
					        'driver' => 's3',
 | 
				
			||||||
@@ -17,7 +18,7 @@ function set_s3_target(S3Storage $s3)
 | 
				
			|||||||
        'bucket' => $s3['bucket'],
 | 
					        'bucket' => $s3['bucket'],
 | 
				
			||||||
        'endpoint' => $s3['endpoint'],
 | 
					        'endpoint' => $s3['endpoint'],
 | 
				
			||||||
        'use_path_style_endpoint' => true,
 | 
					        'use_path_style_endpoint' => true,
 | 
				
			||||||
        'bucket_endpoint' => $is_digital_ocean,
 | 
					        'bucket_endpoint' => $is_digital_ocean || $is_hetzner,
 | 
				
			||||||
        'aws_url' => $s3->awsUrl(),
 | 
					        'aws_url' => $s3->awsUrl(),
 | 
				
			||||||
    ]);
 | 
					    ]);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@
 | 
				
			|||||||
            <x-forms.input required label="Name" id="name" />
 | 
					            <x-forms.input required label="Name" id="name" />
 | 
				
			||||||
            <x-forms.input label="Description" id="description" />
 | 
					            <x-forms.input label="Description" id="description" />
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
        <x-forms.input required type="url" label="Endpoint" id="endpoint" />
 | 
					        <x-forms.input required type="url" label="Endpoint" wire:model.blur="endpoint" />
 | 
				
			||||||
        <div class="flex gap-2">
 | 
					        <div class="flex gap-2">
 | 
				
			||||||
            <x-forms.input required label="Bucket" id="bucket" />
 | 
					            <x-forms.input required label="Bucket" id="bucket" />
 | 
				
			||||||
            <x-forms.input required label="Region" id="region" />
 | 
					            <x-forms.input required label="Region" id="region" />
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user