mirror of
https://github.com/floci-io/floci-cli.git
synced 2026-11-22 21:50:47 -05:00
feat(oci): add floci oci command group for the Floci OCI emulator (#15)
* feat(oci): add floci oci command group for the Floci OCI emulator
Adds the fourth product tree targeting floci-oci (port 4599, container
floci-oci, control prefix /_floci-oci, FLOCI_OCI_* env overrides):
start/stop/restart/status/logs/wait/version/services/doctor/env/config
plus stub snapshot commands, mirroring the GCP/Azure trees.
- 'floci oci env' exports OCI_CLI_ENDPOINT, FLOCI_OCI_ENDPOINT, and
TF_VAR_CLIENT_HOST_OVERRIDES for the OCI CLI, the ocilocal wrapper,
and the oracle/oci Terraform provider; also OCI_CLI_PROFILE=FLOCI
when that profile exists.
- 'floci oci setup' generates an RSA-2048 API signing key with a real
computed fingerprint and writes a throwaway [FLOCI] profile to
~/.oci/config (idempotent, never touches existing profiles) — the
OCI CLI/SDKs refuse to run without them.
- FlociHttpClient now accepts both health 'services' shapes: the array
reported by AWS/GCP/Azure servers and the {name: status} object
reported by floci-oci.
- 'floci config default-product oci' routes bare commands to the tree.
* fix(oci): address review findings on env, services, and setup profile
- Single-quote 'oci env' exports with per-shell escaping (bash/fish/
PowerShell) so endpoint values containing shell metacharacters cannot
inject commands through the documented 'eval $(floci oci env)' flow.
- 'oci services' resolves the endpoint from the container port mapping
like status/wait/env, so a container started with --port <n> is found
without passing --endpoint.
- 'oci env' exports OCI_CLI_PROFILE for whichever profile 'oci setup'
wrote (detected via its key_file marker) instead of only the
hardcoded FLOCI name; DEFAULT is skipped as the CLI uses it
implicitly.
This commit is contained in:
1 parent
2ff3181198
commit
0a65de2303
34 files changed
+1924
-33
No files matched your search
@@ -8,6 +8,8 @@ import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -45,9 +47,21 @@ public class FlociHttpClient {
|
||||
return new HealthInfo(
|
||||
node.path("version").asText("unknown"),
|
||||
node.path("original_edition").asText(node.path("edition").asText("community")),
|
||||
node.path("services").isArray()
|
||||
? MAPPER.convertValue(node.path("services"), String[].class)
|
||||
: new String[0]);
|
||||
serviceNames(node.path("services")));
|
||||
}
|
||||
|
||||
// AWS/GCP/Azure report services as an array of names; OCI reports a
|
||||
// {name: status} object. Accept both.
|
||||
private static String[] serviceNames(JsonNode services) {
|
||||
if (services.isArray()) {
|
||||
return MAPPER.convertValue(services, String[].class);
|
||||
}
|
||||
if (services.isObject()) {
|
||||
List<String> names = new ArrayList<>();
|
||||
services.fieldNames().forEachRemaining(names::add);
|
||||
return names.toArray(String[]::new);
|
||||
}
|
||||
return new String[0];
|
||||
}
|
||||
|
||||
public Optional<HealthInfo> healthOptional() {
|
||||
|
||||
Reference in new issue
Block a user