summaryrefslogtreecommitdiffstats
path: root/container-disc/src
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2020-06-10 14:44:16 +0200
committerBjørn Christian Seime <bjorncs@verizonmedia.com>2020-06-10 15:06:09 +0200
commite0f58988817a64aa549e36bff2b4c89f191e20ee (patch)
tree3273e6f23866911ee8e2492b06fd02b9db6ca7c0 /container-disc/src
parent3d1b445b10f70771cf7a4bce1ba2d285c553f930 (diff)
Move Zone API to separate bundle
Diffstat (limited to 'container-disc/src')
-rw-r--r--container-disc/src/main/java/com/yahoo/container/jdisc/SystemInfoProvider.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/container-disc/src/main/java/com/yahoo/container/jdisc/SystemInfoProvider.java b/container-disc/src/main/java/com/yahoo/container/jdisc/SystemInfoProvider.java
new file mode 100644
index 00000000000..0bb3832ddf5
--- /dev/null
+++ b/container-disc/src/main/java/com/yahoo/container/jdisc/SystemInfoProvider.java
@@ -0,0 +1,27 @@
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.container.jdisc;
+
+import ai.vespa.cloud.Environment;
+import ai.vespa.cloud.SystemInfo;
+import ai.vespa.cloud.Zone;
+import com.google.inject.Inject;
+import com.yahoo.cloud.config.ConfigserverConfig;
+import com.yahoo.component.AbstractComponent;
+import com.yahoo.container.di.componentgraph.Provider;
+
+/**
+ * Provides information about the system in which this container is running.
+ * This is available and can be injected when running in a cloud environment.
+ *
+ * @author bratseth
+ */
+public class SystemInfoProvider extends AbstractComponent implements Provider<SystemInfo> {
+
+ private final SystemInfo instance;
+
+ @Inject public SystemInfoProvider(ConfigserverConfig config) {
+ this.instance = new SystemInfo(new Zone(Environment.valueOf(config.environment()), config.region()));
+ }
+
+ @Override public SystemInfo get() { return instance; }
+}