Skip to content

Commit

Permalink
feat: #199 support docker registry username encryption
Browse files Browse the repository at this point in the history
  • Loading branch information
bohdan-shulha committed Sep 24, 2024
1 parent 21371d9 commit 4241af6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/Models/SwarmData/DockerRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public function __construct(
public string $name,
public ?string $dockerName,
public string $serverAddress,
#[RequiredWithout('dockerName')]
public string $username,
#[RequiredWithout('dockerName')]
public ?string $password
Expand All @@ -23,6 +24,6 @@ public function sameAs(?DockerRegistry $other): bool
return false;
}

return $this->serverAddress === $other->serverAddress && $this->username === $other->username && is_null($this->password);
return $this->serverAddress === $other->serverAddress && is_null($this->username) && is_null($this->password);
}
}
4 changes: 4 additions & 0 deletions resources/js/Pages/Nodes/Partials/DockerRegistries.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const { encrypt } = useCrypto();
const form = useForm({
registries: props.swarm.data.registries.map((registry) => ({
...registry,
username: null,
password: null,
})),
});
Expand All @@ -41,6 +42,9 @@ const submitForm = async () => {
for (const registry of formData.registries) {
const registryData = {
...registry,
username: registry.username
? await encrypt(registry.username)
: null,
password: registry.password
? await encrypt(registry.password)
: null,
Expand Down

0 comments on commit 4241af6

Please sign in to comment.