Skip to content

Commit

Permalink
Merge pull request alibaba#820 from alibaba/feature_fetchIp
Browse files Browse the repository at this point in the history
Feature fetch ip
  • Loading branch information
TsingLiang authored Feb 25, 2019
2 parents 12432b0 + 5b711c6 commit 6b448c4
Show file tree
Hide file tree
Showing 36 changed files with 379 additions and 120 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
import java.util.HashMap;
import java.util.Map;

import static com.alibaba.nacos.common.util.SystemUtils.LOCAL_IP;
import static com.alibaba.nacos.core.utils.SystemUtils.LOCAL_IP;

/**
* 软负载客户端发布数据专用控制器
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import java.util.List;
import java.util.Map;

import static com.alibaba.nacos.common.util.SystemUtils.STANDALONE_MODE;
import static com.alibaba.nacos.core.utils.SystemUtils.STANDALONE_MODE;
import static com.alibaba.nacos.config.server.utils.LogUtil.pullLog;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

import javax.annotation.PostConstruct;

import static com.alibaba.nacos.common.util.SystemUtils.LOCAL_IP;
import static com.alibaba.nacos.core.utils.SystemUtils.LOCAL_IP;

/**
* health service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package com.alibaba.nacos.config.server.model.app;

import static com.alibaba.nacos.common.util.SystemUtils.LOCAL_IP;
import static com.alibaba.nacos.core.utils.SystemUtils.LOCAL_IP;

/**
* app info
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.support.TransactionTemplate;

import static com.alibaba.nacos.common.util.SystemUtils.STANDALONE_MODE;
import static com.alibaba.nacos.core.utils.SystemUtils.STANDALONE_MODE;
import static com.alibaba.nacos.config.server.service.PersistService.CONFIG_INFO4BETA_ROW_MAPPER;
import static com.alibaba.nacos.config.server.utils.LogUtil.defaultLog;
import static com.alibaba.nacos.config.server.utils.LogUtil.fatalLog;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;

import static com.alibaba.nacos.common.util.SystemUtils.STANDALONE_MODE;
import static com.alibaba.nacos.core.utils.SystemUtils.STANDALONE_MODE;
import static com.alibaba.nacos.config.server.utils.LogUtil.*;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import java.io.FileNotFoundException;
import java.io.IOException;

import static com.alibaba.nacos.common.util.SystemUtils.NACOS_HOME;
import static com.alibaba.nacos.core.utils.SystemUtils.NACOS_HOME;

/**
* 磁盘操作工具类。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

import static com.alibaba.nacos.common.util.SystemUtils.STANDALONE_MODE;
import static com.alibaba.nacos.core.utils.SystemUtils.STANDALONE_MODE;

/**
* datasource adapter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
import java.util.List;
import java.util.concurrent.TimeUnit;

import static com.alibaba.nacos.common.util.SystemUtils.NACOS_HOME;
import static com.alibaba.nacos.common.util.SystemUtils.NACOS_HOME_KEY;
import static com.alibaba.nacos.common.util.SystemUtils.STANDALONE_MODE;
import static com.alibaba.nacos.core.utils.SystemUtils.NACOS_HOME;
import static com.alibaba.nacos.core.utils.SystemUtils.NACOS_HOME_KEY;
import static com.alibaba.nacos.core.utils.SystemUtils.STANDALONE_MODE;

/**
* local data source
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;

import static com.alibaba.nacos.common.util.SystemUtils.LOCAL_IP;
import static com.alibaba.nacos.common.util.SystemUtils.STANDALONE_MODE;
import static com.alibaba.nacos.common.util.SystemUtils.readClusterConf;
import static com.alibaba.nacos.core.utils.SystemUtils.LOCAL_IP;
import static com.alibaba.nacos.core.utils.SystemUtils.STANDALONE_MODE;
import static com.alibaba.nacos.core.utils.SystemUtils.readClusterConf;
import static com.alibaba.nacos.config.server.utils.LogUtil.defaultLog;
import static com.alibaba.nacos.config.server.utils.LogUtil.fatalLog;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import java.sql.*;
import java.util.List;

import static com.alibaba.nacos.common.util.SystemUtils.STANDALONE_MODE;
import static com.alibaba.nacos.core.utils.SystemUtils.STANDALONE_MODE;
import static com.alibaba.nacos.config.server.utils.LogUtil.fatalLog;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import java.sql.*;
import java.util.List;

import static com.alibaba.nacos.common.util.SystemUtils.STANDALONE_MODE;
import static com.alibaba.nacos.core.utils.SystemUtils.STANDALONE_MODE;
import static com.alibaba.nacos.config.server.utils.LogUtil.fatalLog;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

import static com.alibaba.nacos.common.util.SystemUtils.LOCAL_IP;
import static com.alibaba.nacos.common.util.SystemUtils.STANDALONE_MODE;
import static com.alibaba.nacos.core.utils.SystemUtils.LOCAL_IP;
import static com.alibaba.nacos.core.utils.SystemUtils.STANDALONE_MODE;
import static com.alibaba.nacos.config.server.utils.LogUtil.fatalLog;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

import static com.alibaba.nacos.common.util.SystemUtils.LOCAL_IP;
import static com.alibaba.nacos.core.utils.SystemUtils.LOCAL_IP;

/**
* 数据聚合服务。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import java.util.ArrayList;
import java.util.List;

import static com.alibaba.nacos.common.util.SystemUtils.LOCAL_IP;
import static com.alibaba.nacos.core.utils.SystemUtils.LOCAL_IP;

/**
* Merge task processor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import java.util.Queue;
import java.util.concurrent.*;

import static com.alibaba.nacos.common.util.SystemUtils.LOCAL_IP;
import static com.alibaba.nacos.core.utils.SystemUtils.LOCAL_IP;

/**
* Async notify service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import java.util.List;
import java.util.concurrent.TimeUnit;

import static com.alibaba.nacos.common.util.SystemUtils.LOCAL_IP;
import static com.alibaba.nacos.core.utils.SystemUtils.LOCAL_IP;

/**
* 通知服务。数据库变更后,通知所有server,包括自己,加载新数据。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import java.util.concurrent.TimeUnit;

import static com.alibaba.nacos.common.util.SystemUtils.LOCAL_IP;
import static com.alibaba.nacos.core.utils.SystemUtils.LOCAL_IP;

/**
* Config trace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import java.util.List;

import static com.alibaba.nacos.common.util.SystemUtils.STANDALONE_MODE;
import static com.alibaba.nacos.core.utils.SystemUtils.STANDALONE_MODE;

/**
* 分页辅助类
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import javax.annotation.PostConstruct;

import static com.alibaba.nacos.common.util.SystemUtils.STANDALONE_MODE;
import static com.alibaba.nacos.core.utils.SystemUtils.STANDALONE_MODE;

/**
* properties utils
Expand Down
3 changes: 3 additions & 0 deletions console/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@



12 changes: 12 additions & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@

<name>nacos-core ${project.version}</name>
<url>http://maven.apache.org</url>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>7</source>
<target>7</target>
</configuration>
</plugin>
</plugins>
</build>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@

import java.util.Arrays;

import static com.alibaba.nacos.common.util.Constants.STANDALONE_SPRING_PROFILE;
import static com.alibaba.nacos.common.util.SystemUtils.STANDALONE_MODE;
import static com.alibaba.nacos.common.util.SystemUtils.STANDALONE_MODE_PROPERTY_NAME;
import static com.alibaba.nacos.core.utils.Constants.STANDALONE_MODE_PROPERTY_NAME;
import static com.alibaba.nacos.core.utils.Constants.STANDALONE_SPRING_PROFILE;
import static com.alibaba.nacos.core.utils.SystemUtils.STANDALONE_MODE;

/**
* Standalone {@link Profile} {@link ApplicationListener} for {@link ApplicationEnvironmentPreparedEvent}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;

import static com.alibaba.nacos.common.util.SystemUtils.LOCAL_IP;
import static com.alibaba.nacos.common.util.SystemUtils.NACOS_HOME;
import static com.alibaba.nacos.common.util.SystemUtils.STANDALONE_MODE;
import static com.alibaba.nacos.common.util.SystemUtils.readClusterConf;
import static com.alibaba.nacos.core.utils.SystemUtils.LOCAL_IP;
import static com.alibaba.nacos.core.utils.SystemUtils.NACOS_HOME;
import static com.alibaba.nacos.core.utils.SystemUtils.STANDALONE_MODE;
import static com.alibaba.nacos.core.utils.SystemUtils.readClusterConf;

/**
* Logging starting message {@link SpringApplicationRunListener} before {@link EventPublishingRunListener} execution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.nacos.common.util;
package com.alibaba.nacos.core.utils;

/**
* Nacos common constants
Expand All @@ -27,4 +27,23 @@ public interface Constants {
* Spring Profile : "standalone"
*/
String STANDALONE_SPRING_PROFILE = "standalone";

/**
* The System property name of Standalone mode
*/
String STANDALONE_MODE_PROPERTY_NAME = "nacos.standalone";

/**
* The System property name of prefer hostname over ip
*/
String PREFER_HOSTNAME_OVER_IP_PROPERTY_NAME = "nacos.preferHostnameOverIp";

String NACOS_SERVER_IP = "nacos.server.ip";

String USE_ONLY_SITE_INTERFACES = "nacos.inetutils.use-only-site-local-interfaces";
String PREFERRED_NETWORKS = "nacos.inetutils.preferred-networks";
String IGNORED_INTERFACES = "nacos.inetutils.ignored-interfaces";
String IP_ADDRESS = "nacos.inetutils.ip-address";
String PREFER_HOSTNAME_OVER_IP = "nacos.inetutils.prefer-hostname-over-ip";
String SYSTEM_PREFER_HOSTNAME_OVER_IP = "nacos.preferHostnameOverIp";
}
Loading

0 comments on commit 6b448c4

Please sign in to comment.