-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
522 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
dove-config-admin/src/main/java/com/licc/dove/service/DoveConfigAppService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 4 additions & 5 deletions
9
dove-config-admin/src/main/java/com/licc/dove/service/DoveConfigPropertiesService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,5 +23,5 @@ public class DoveConfigPropertiesVO { | |
|
||
String appName; | ||
String appProfile; | ||
|
||
String appLable; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
dove-config-client/src/main/java/com/licc/dove/ConfigProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.licc.dove; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
|
||
/** | ||
* 自定义属性 | ||
* | ||
* @author lichangchao | ||
* @version 1.0.0 | ||
* @date 2018/1/4 9:55 | ||
* @see | ||
*/ | ||
@ConfigurationProperties(prefix = "config", ignoreUnknownFields = false) | ||
public class ConfigProperties { | ||
private final Mail mail = new Mail(); | ||
|
||
public Mail getMail() { | ||
return mail; | ||
} | ||
|
||
public static class Mail { | ||
|
||
private String from = "tuxAdmin@localhost"; | ||
|
||
public String getFrom() { | ||
return from; | ||
} | ||
|
||
public void setFrom(String from) { | ||
this.from = from; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
dove-config-server/src/main/java/com/licc/dove/config/service/ApiService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.licc.dove.config.service; | ||
|
||
import com.licc.dove.config.domin.DoveConfigEnv; | ||
import com.licc.dove.config.domin.DoveConfigEnvIp; | ||
import com.licc.dove.dao.CommonDao; | ||
import java.util.List; | ||
import javax.annotation.Resource; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
import org.springframework.util.CollectionUtils; | ||
|
||
/** | ||
* | ||
* @author lichangchao | ||
* @version 1.0.0 | ||
* @date 2018/1/4 13:45 | ||
* @see | ||
*/ | ||
@Service | ||
@Transactional | ||
public class ApiService { | ||
@Resource | ||
CommonDao commonDao; | ||
/** | ||
* 通过IP获取当前环境 | ||
* @param ip | ||
* @return | ||
*/ | ||
public String getProfileByIp(String ip){ | ||
DoveConfigEnvIp env = new DoveConfigEnvIp(); | ||
env.setDeleteFlag(false); | ||
env.setIp(ip); | ||
List<DoveConfigEnvIp> list = commonDao.listByExample(env); | ||
if(CollectionUtils.isEmpty(list))return "dev"; | ||
DoveConfigEnvIp envIp = list.get(0); | ||
Long envId = envIp.getConfigEnvId(); | ||
DoveConfigEnv doveConfigEnv = commonDao.get(DoveConfigEnv.class,envId); | ||
if(doveConfigEnv==null) return "dev"; | ||
return doveConfigEnv.getProfile(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.