Search in sources :

Example 1 with OciObjectStorageRx

use of io.helidon.integrations.oci.objectstorage.OciObjectStorageRx in project helidon by oracle.

the class OciObjectStorageMain method main.

/**
 * Main method.
 *
 * @param args ignored
 */
public static void main(String[] args) {
    LogConfig.configureRuntime();
    // as I cannot share my configuration of OCI, let's combine the configuration
    // from my home directory with the one compiled into the jar
    // when running this example, you can either update the application.yaml in resources directory
    // or use the same approach
    Config config = buildConfig();
    Config ociConfig = config.get("oci");
    // this requires OCI configuration in the usual place
    // ~/.oci/config
    OciObjectStorageRx ociObjectStorage = OciObjectStorageRx.create(ociConfig);
    // the following parameters are required
    String bucketName = ociConfig.get("objectstorage").get("bucket").asString().get();
    String namespace = ociConfig.get("objectstorage").get("namespace").asString().get();
    // setup ObjectStorage health check
    HealthSupport health = HealthSupport.builder().addLiveness(OciObjectStorageHealthCheck.builder().ociObjectStorage(ociObjectStorage).addBucket(bucketName).namespace(namespace).build()).build();
    WebServer.builder().config(config.get("server")).routing(Routing.builder().register(health).register("/files", new ObjectStorageService(ociObjectStorage, bucketName))).build().start().await();
}
Also used : Config(io.helidon.config.Config) LogConfig(io.helidon.common.LogConfig) HealthSupport(io.helidon.health.HealthSupport) OciObjectStorageRx(io.helidon.integrations.oci.objectstorage.OciObjectStorageRx)

Aggregations

LogConfig (io.helidon.common.LogConfig)1 Config (io.helidon.config.Config)1 HealthSupport (io.helidon.health.HealthSupport)1 OciObjectStorageRx (io.helidon.integrations.oci.objectstorage.OciObjectStorageRx)1