summaryrefslogtreecommitdiffstats
path: root/container-disc
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
parent3d1b445b10f70771cf7a4bce1ba2d285c553f930 (diff)
Move Zone API to separate bundle
Diffstat (limited to 'container-disc')
-rw-r--r--container-disc/pom.xml7
-rw-r--r--container-disc/src/main/java/com/yahoo/container/jdisc/SystemInfoProvider.java27
2 files changed, 34 insertions, 0 deletions
diff --git a/container-disc/pom.xml b/container-disc/pom.xml
index 15b8cd08808..48872d0665b 100644
--- a/container-disc/pom.xml
+++ b/container-disc/pom.xml
@@ -106,6 +106,12 @@
<artifactId>vespalog</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>com.yahoo.vespa</groupId>
+ <artifactId>hosted-zone-api</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
<!-- WARNING: These are only here to make bundlification work -->
<dependency>
<groupId>com.yahoo.vespa</groupId>
@@ -184,6 +190,7 @@
container-search-and-docproc-jar-with-dependencies.jar,
container-search-gui-jar-with-dependencies.jar,
docprocs-jar-with-dependencies.jar,
+ hosted-zone-api-jar-with-dependencies.jar,
jdisc-security-filters-jar-with-dependencies.jar,
jdisc_http_service-jar-with-dependencies.jar,
model-evaluation-jar-with-dependencies.jar,
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; }
+}