Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
apollo
Commits
6a50e2a2
Commit
6a50e2a2
authored
May 24, 2016
by
lepdou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
envs 配置在db里
parent
39c0c08a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
PortalSettings.java
...ava/com/ctrip/framework/apollo/portal/PortalSettings.java
+19
-2
portal.properties
apollo-portal/src/main/resources/portal.properties
+1
-1
No files found.
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/PortalSettings.java
View file @
6a50e2a2
package
com
.
ctrip
.
framework
.
apollo
.
portal
;
import
com.google.common.collect.Lists
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.LinkedList
;
import
java.util.List
;
...
...
@@ -22,6 +25,8 @@ import org.springframework.stereotype.Component;
import
com.ctrip.framework.apollo.core.enums.Env
;
import
com.ctrip.framework.apollo.portal.api.AdminServiceAPI
;
import
com.ctrip.framework.apollo.portal.entity.po.ServerConfig
;
import
com.ctrip.framework.apollo.portal.repository.ServerConfigRepository
;
@Component
public
class
PortalSettings
{
...
...
@@ -30,12 +35,15 @@ public class PortalSettings {
private
static
final
int
HEALTH_CHECK_INTERVAL
=
5000
;
@Value
(
"#{'${apollo.portal.env}'.split(',')}"
)
@Value
(
"#{'${apollo.portal.env
s
}'.split(',')}"
)
private
List
<
String
>
allStrEnvs
;
@Autowired
ApplicationContext
applicationContext
;
@Autowired
private
ServerConfigRepository
serverConfigRepository
;
private
List
<
Env
>
allEnvs
=
new
ArrayList
<
Env
>();
private
List
<
Env
>
activeEnvs
;
...
...
@@ -47,11 +55,20 @@ public class PortalSettings {
@PostConstruct
private
void
postConstruct
()
{
//init origin config envs
//初始化portal支持操作的环境集合,线上的portal可能支持所有的环境操作,而线下环境则支持一部分.
// 每个环境的portal支持哪些环境配置在数据库里
ServerConfig
serverConfig
=
serverConfigRepository
.
findByKey
(
"apollo.portal.envs"
);
// TODO: 16/5/24 线上环境暂时从本地配置里拿,之后也放在数据库上并提供界面可操作
if
(
serverConfig
!=
null
){
//如果db有配置则从db里取
String
[]
configedEnvs
=
serverConfig
.
getValue
().
split
(
","
);
allStrEnvs
=
Arrays
.
asList
(
configedEnvs
);
}
for
(
String
e
:
allStrEnvs
)
{
allEnvs
.
add
(
Env
.
valueOf
(
e
.
toUpperCase
()));
}
for
(
Env
env
:
allEnvs
)
{
envStatusMark
.
put
(
env
,
true
);
}
...
...
apollo-portal/src/main/resources/portal.properties
View file @
6a50e2a2
spring.application.name
=
apollo-portal
apollo.portal.env
=
fat,uat
apollo.portal.env
s
=
fat,uat,pro
ctrip.appid
=
100003173
server.port
=
8070
logging.file
=
/opt/logs/100003173/apollo-portal.log
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment