package app.mealsmadeeasy.api;

import org.junit.jupiter.api.extension.BeforeAllCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.testcontainers.containers.MinIOContainer;

public class MinIOTestsExtension implements BeforeAllCallback {

    private final MinIOContainer container = new MinIOContainer("minio/minio:latest");

    @Override
    public void beforeAll(ExtensionContext context) {
        this.container.start();
        System.setProperty("app.mealsmadeeasy.api.minio.endpoint", this.container.getS3URL());
        System.setProperty("app.mealsmadeeasy.api.minio.accessKey", this.container.getUserName());
        System.setProperty("app.mealsmadeeasy.api.minio.secretKey", this.container.getPassword());
    }

    public MinIOContainer getContainer() {
        return this.container;
    }

}
