♻️ Transform to IDP provider
This commit is contained in:
parent
2d7af6fb0f
commit
6fcfc79aa4
@ -9,7 +9,9 @@ import io.quarkus.runtime.Startup;
|
|||||||
import jakarta.enterprise.context.ApplicationScoped;
|
import jakarta.enterprise.context.ApplicationScoped;
|
||||||
import jakarta.inject.Inject;
|
import jakarta.inject.Inject;
|
||||||
import jakarta.transaction.Transactional;
|
import jakarta.transaction.Transactional;
|
||||||
|
import org.eclipse.microprofile.config.inject.ConfigProperty;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -17,9 +19,11 @@ import java.util.Map;
|
|||||||
@ApplicationScoped
|
@ApplicationScoped
|
||||||
public class BootstrapService
|
public class BootstrapService
|
||||||
{
|
{
|
||||||
private static final Path PATH = Path.of("/home/andreas/Documents/dev/iam-backend/src/main/resources/bootstrap.yaml");
|
|
||||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(new YAMLFactory()).configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(new YAMLFactory()).configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
|
|
||||||
|
@ConfigProperty(name = "io.verifoo.bootstrap.config.location")
|
||||||
|
String configLocation;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
RealmBootstrapService realmBootstrapService;
|
RealmBootstrapService realmBootstrapService;
|
||||||
|
|
||||||
@ -31,7 +35,7 @@ public class BootstrapService
|
|||||||
void bootstrap() throws IOException
|
void bootstrap() throws IOException
|
||||||
{
|
{
|
||||||
superuserBootstrapper.bootstrap();
|
superuserBootstrapper.bootstrap();
|
||||||
Bootstrap bootstrap = OBJECT_MAPPER.readValue(PATH.toFile(), Bootstrap.class);
|
Bootstrap bootstrap = OBJECT_MAPPER.readValue(new File(configLocation), Bootstrap.class);
|
||||||
for (Map.Entry<String, Realm> realmEntry : bootstrap.realms().entrySet())
|
for (Map.Entry<String, Realm> realmEntry : bootstrap.realms().entrySet())
|
||||||
{
|
{
|
||||||
realmBootstrapService.bootstrap(realmEntry);
|
realmBootstrapService.bootstrap(realmEntry);
|
||||||
|
|||||||
@ -29,5 +29,8 @@ quarkus.http.auth.basic=true
|
|||||||
|
|
||||||
io.verifoo.http.origin=http://localhost:8089
|
io.verifoo.http.origin=http://localhost:8089
|
||||||
|
|
||||||
|
%dev.io.verifoo.bootstrap.config.location=/home/andreas/Documents/dev/iam-backend/src/main/resources/bootstrap.yaml
|
||||||
%dev.io.verifoo.superuser.username=admin
|
%dev.io.verifoo.superuser.username=admin
|
||||||
%dev.io.verifoo.superuser.password=pw
|
%dev.io.verifoo.superuser.password=pw
|
||||||
|
|
||||||
|
%prod.io.verifoo.bootstrap.config.location=/var/lib/verifoo/bootstrap.yaml
|
||||||
Loading…
x
Reference in New Issue
Block a user