Skip to content

Commit 4241af6

Browse files
committed
feat: #199 support docker registry username encryption
1 parent 21371d9 commit 4241af6

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Diff for: app/Models/SwarmData/DockerRegistry.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public function __construct(
1212
public string $name,
1313
public ?string $dockerName,
1414
public string $serverAddress,
15+
#[RequiredWithout('dockerName')]
1516
public string $username,
1617
#[RequiredWithout('dockerName')]
1718
public ?string $password
@@ -23,6 +24,6 @@ public function sameAs(?DockerRegistry $other): bool
2324
return false;
2425
}
2526

26-
return $this->serverAddress === $other->serverAddress && $this->username === $other->username && is_null($this->password);
27+
return $this->serverAddress === $other->serverAddress && is_null($this->username) && is_null($this->password);
2728
}
2829
}

Diff for: resources/js/Pages/Nodes/Partials/DockerRegistries.vue

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const { encrypt } = useCrypto();
1818
const form = useForm({
1919
registries: props.swarm.data.registries.map((registry) => ({
2020
...registry,
21+
username: null,
2122
password: null,
2223
})),
2324
});
@@ -41,6 +42,9 @@ const submitForm = async () => {
4142
for (const registry of formData.registries) {
4243
const registryData = {
4344
...registry,
45+
username: registry.username
46+
? await encrypt(registry.username)
47+
: null,
4448
password: registry.password
4549
? await encrypt(registry.password)
4650
: null,

0 commit comments

Comments
 (0)