mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 22:11:36 -05:00
fix: init shows wrong status when tls is enabled and adding app config (#1006)
* fix(lifecycle,appconfig): TLS startup readiness and listHostedConfigurationVersions
Fixes two independent issues:
is enabled, Quarkus binds the HTTP backend on port 4510 and the HttpServerStart
event fires with that port, so markStartCompleted/markReadyCompleted were never
called and /_floci/init always returned ready=false. Fix: derive the expected
port from config.tls().enabled() at observer time.
/applications/{appId}/configurationprofiles/{profileId}/hostedconfigurationversions.
Unmatched requests fell through to S3Controller's catch-all and returned a
NoSuchBucket XML error. Fix: add HostedConfigurationVersionSummary model,
listHostedConfigurationVersions service method, and the missing GET route.
* fix(commit-checks): fix action that check commit format
This commit is contained in:
1 parent
be01ee0747
commit
bf093ce0f4
7 files changed
+180
-35
No files matched your search
@@ -35,6 +35,7 @@ public class EmulatorLifecycle {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(EmulatorLifecycle.class);
|
||||
private static final int HTTP_PORT = 4566;
|
||||
private static final int TLS_HTTP_BACKEND_PORT = 4510;
|
||||
|
||||
@ConfigProperty(name = "quarkus.application.version", defaultValue = "")
|
||||
Optional<String> appVersion = Optional.empty();
|
||||
@@ -130,7 +131,8 @@ public class EmulatorLifecycle {
|
||||
}
|
||||
|
||||
void onHttpStart(@ObservesAsync HttpServerStart event) {
|
||||
if (event.options().getPort() != HTTP_PORT) {
|
||||
int expectedPort = config.tls().enabled() ? TLS_HTTP_BACKEND_PORT : HTTP_PORT;
|
||||
if (event.options().getPort() != expectedPort) {
|
||||
return;
|
||||
}
|
||||
boolean hasStart = initializationHooksRunner.hasHooks(InitializationHook.START);
|
||||
|
||||
@@ -120,6 +120,17 @@ public class AppConfigController {
|
||||
|
||||
// ──────────────────────────── Hosted Configuration Version ────────────────────────────
|
||||
|
||||
@GET
|
||||
@Path("/applications/{appId}/configurationprofiles/{profileId}/hostedconfigurationversions")
|
||||
public Response listHostedConfigurationVersions(@PathParam("appId") String appId,
|
||||
@PathParam("profileId") String profileId) {
|
||||
List<HostedConfigurationVersionSummary> items = service.listHostedConfigurationVersions(appId, profileId);
|
||||
ObjectNode root = objectMapper.createObjectNode();
|
||||
ArrayNode arr = root.putArray("Items");
|
||||
items.forEach(arr::addPOJO);
|
||||
return Response.ok(root).build();
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/applications/{appId}/configurationprofiles/{profileId}/hostedconfigurationversions")
|
||||
@Consumes(MediaType.WILDCARD)
|
||||
|
||||
@@ -136,6 +136,23 @@ public class AppConfigService {
|
||||
.orElseThrow(() -> new AwsException("ResourceNotFoundException", "Hosted configuration version not found", 404));
|
||||
}
|
||||
|
||||
public List<HostedConfigurationVersionSummary> listHostedConfigurationVersions(String appId, String profileId) {
|
||||
String prefix = appId + "::" + profileId + "::";
|
||||
return versionStore.scan(k -> k.startsWith(prefix))
|
||||
.stream()
|
||||
.sorted(Comparator.comparingInt(HostedConfigurationVersion::getVersionNumber))
|
||||
.map(v -> {
|
||||
HostedConfigurationVersionSummary s = new HostedConfigurationVersionSummary();
|
||||
s.setApplicationId(v.getApplicationId());
|
||||
s.setConfigurationProfileId(v.getConfigurationProfileId());
|
||||
s.setVersionNumber(v.getVersionNumber());
|
||||
s.setDescription(v.getDescription());
|
||||
s.setContentType(v.getContentType());
|
||||
return s;
|
||||
})
|
||||
.toList();
|
||||
}
|
||||
|
||||
// ──────────────────────────── Deployment Strategy ────────────────────────────
|
||||
|
||||
public DeploymentStrategy createDeploymentStrategy(Map<String, Object> request) {
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package io.github.hectorvent.floci.services.appconfig.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
|
||||
@RegisterForReflection
|
||||
public class HostedConfigurationVersionSummary {
|
||||
|
||||
@JsonProperty("ApplicationId")
|
||||
private String applicationId;
|
||||
@JsonProperty("ConfigurationProfileId")
|
||||
private String configurationProfileId;
|
||||
@JsonProperty("VersionNumber")
|
||||
private int versionNumber;
|
||||
@JsonProperty("Description")
|
||||
private String description;
|
||||
@JsonProperty("ContentType")
|
||||
private String contentType;
|
||||
|
||||
public HostedConfigurationVersionSummary() {}
|
||||
|
||||
public String getApplicationId() { return applicationId; }
|
||||
public void setApplicationId(String applicationId) { this.applicationId = applicationId; }
|
||||
|
||||
public String getConfigurationProfileId() { return configurationProfileId; }
|
||||
public void setConfigurationProfileId(String configurationProfileId) { this.configurationProfileId = configurationProfileId; }
|
||||
|
||||
public int getVersionNumber() { return versionNumber; }
|
||||
public void setVersionNumber(int versionNumber) { this.versionNumber = versionNumber; }
|
||||
|
||||
public String getDescription() { return description; }
|
||||
public void setDescription(String description) { this.description = description; }
|
||||
|
||||
public String getContentType() { return contentType; }
|
||||
public void setContentType(String contentType) { this.contentType = contentType; }
|
||||
}
|
||||
Reference in new issue
Block a user