summaryrefslogtreecommitdiffstats
path: root/container-disc
diff options
context:
space:
mode:
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; }
+}