UNPKG

@testcontainers/minio

Version:
59 lines 1.99 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StartedMinioContainer = exports.MinioContainer = void 0; const testcontainers_1 = require("testcontainers"); const MINIO_PORT = 9000; const MINIO_UI_PORT = 9001; class MinioContainer extends testcontainers_1.GenericContainer { username = "minioadmin"; password = "minioadmin"; constructor(image) { super(image); this.withExposedPorts(MINIO_PORT, MINIO_UI_PORT); this.withWaitStrategy(testcontainers_1.Wait.forAll([testcontainers_1.Wait.forHttp("/minio/health/live", MINIO_PORT)])); this.withCommand(["server", "--console-address", `:${MINIO_UI_PORT}`, "/data"]); } withUsername(username) { this.username = username; return this; } withPassword(password) { this.password = password; return this; } async start() { this.withEnvironment({ MINIO_ROOT_USER: this.username, MINIO_ROOT_PASSWORD: this.password, }); const startedContainer = await super.start(); return new StartedMinioContainer(startedContainer, this.username, this.password); } } exports.MinioContainer = MinioContainer; class StartedMinioContainer extends testcontainers_1.AbstractStartedContainer { username; password; constructor(startedTestContainer, username, password) { super(startedTestContainer); this.username = username; this.password = password; } getPort() { return this.startedTestContainer.getMappedPort(MINIO_PORT); } getUiPort() { return this.startedTestContainer.getMappedPort(MINIO_UI_PORT); } getUsername() { return this.username; } getPassword() { return this.password; } getConnectionUrl() { return `http://${this.getHost()}:${this.getPort()}`; } } exports.StartedMinioContainer = StartedMinioContainer; //# sourceMappingURL=minio-container.js.map