Skip to content

Commit 8ce8bf1

Browse files
📝 Add docstrings to feat/switch-to-k8s
Docstrings generation was requested by @coodos. * #179 (comment) The following files were modified: * `infrastructure/evault-provisioner/src/templates/evault.nomad.ts`
1 parent c817701 commit 8ce8bf1

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

infrastructure/evault-provisioner/src/templates/evault.nomad.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ import * as k8s from '@kubernetes/client-node';
33
import { execSync } from "child_process";
44
import { json } from "express";
55

6+
/**
7+
* Generates a cryptographically secure random alphanumeric password of the specified length.
8+
*
9+
* @param length - The desired length of the generated password. Defaults to 16.
10+
* @returns A random password consisting of uppercase letters, lowercase letters, and digits.
11+
*/
612
export function generatePassword(length = 16): string {
713
const chars =
814
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
@@ -19,6 +25,17 @@ export function generatePassword(length = 16): string {
1925
return result;
2026
}
2127

28+
/**
29+
* Provisions an eVault environment in a dedicated Kubernetes namespace and returns its accessible URL.
30+
*
31+
* Creates a namespace, persistent volume claims, a deployment with Neo4j and eVault containers, and a LoadBalancer service. The Neo4j password is derived by hashing the domain part of the provided {@link w3id}. The function determines the service endpoint using the LoadBalancer IP/hostname, node IP and NodePort, or Minikube IP as a fallback.
32+
*
33+
* @param w3id - The W3ID identifier, used to derive the namespace and database password.
34+
* @param eVaultId - The unique identifier for the eVault instance.
35+
* @returns The HTTP URL for accessing the provisioned eVault service.
36+
*
37+
* @throws {Error} If the service endpoint cannot be determined from the cluster.
38+
*/
2239
export async function provisionEVault(w3id: string, eVaultId: string) {
2340
const idParts = w3id.split('@');
2441
w3id = idParts[idParts.length - 1]

0 commit comments

Comments
 (0)