Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement]: Add OpenFGAContainer #8367

Closed
rwinch opened this issue Feb 22, 2024 · 0 comments · Fixed by #8371
Closed

[Enhancement]: Add OpenFGAContainer #8367

rwinch opened this issue Feb 22, 2024 · 0 comments · Fixed by #8371

Comments

@rwinch
Copy link
Contributor

rwinch commented Feb 22, 2024

Module

Core

Proposal

Spring Security is currently working on adding support for OpenFGA and I think that adding official Testcontainers support for OpenFga's Existing Docker Image . I'm able to do this with a GenericContainer, but it is a little bit of work to get working because the default checks do not work due to the image being hardened (e.g. /bin/sh is not available).

For the record this is what I'm currently doing (it could certainly use polish as well):

@Bean
GenericContainer<?> openFgaContainer(DynamicPropertyRegistry registry) {
var result = new GenericContainer<>("openfga/openfga:latest")
		.withCommand("run")
		.waitingFor(Wait.forHttp("/playground").forPort(3000).withStartupTimeout(Duration.ofMinutes(2)))
		.withEnv("OPENFGA_HTTP_ADDR","0.0.0.0:4000")
		.withExposedPorts(4000, 8081, 3000);
registry.add("openfga.fgaApiUrl", () -> {
	Integer httpPort = result.getMappedPort(4000);
	return "http://localhost:"+httpPort;
});
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant