2 * ============LICENSE_START====================================
3 * DCAEGEN2-SERVICES-SDK
4 * =========================================================
5 * Copyright (C) 2019 Nokia. All rights reserved.
6 * =========================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=====================================
21 package org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model;
23 import org.immutables.value.Value;
26 * Immutable object which helps with construction of cloudRequestObject for specified Client. For usage take a look in
27 * CloudConfigurationClient.class
29 * @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 11/16/18
30 * @version 1.0.0 can be passed to ReactiveCloudConfigurationProvider, can be constructed out of
31 * org.onap.dcaegen2.services.sdk library.
34 @Value.Immutable(prehash = true)
35 public interface EnvProperties {
38 * Name of environment variable containing Consul host name.
40 String ENV_CONSUL_HOST = "CONSUL_HOST";
43 * Name of environment variable containing Config Binding Service <em>service name</em> as registered in Consul
46 String ENV_CBS_NAME = "CONFIG_BINDING_SERVICE";
49 * Name of environment variable containing current application name.
51 String ENV_APP_NAME = "HOSTNAME";
66 * Creates EnvProperties from system environment variables.
68 * @return an instance of EnvProperties
69 * @throws NullPointerException when at least one of required parameters is missing
71 static EnvProperties fromEnvironment() {
72 return ImmutableEnvProperties.builder()
73 .consulHost(System.getenv(ENV_CONSUL_HOST))
75 .cbsName(System.getenv(ENV_CBS_NAME))
76 .appName(System.getenv(ENV_APP_NAME))