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
f0224e9c
Commit
f0224e9c
authored
Jun 02, 2016
by
Jason Song
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update apollo client readme
parent
8b78bf03
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
2 deletions
+76
-2
README.md
apollo-client/README.md
+76
-2
app-id-location.png
apollo-client/doc/pic/app-id-location.png
+0
-0
No files found.
apollo-client/README.md
View file @
f0224e9c
## Maven Dependency
## I. Prerequisite
### I.I Mandatory Setup
Apollo client requires
`AppId`
and
`Environment`
information available to function properly, so please read the following and configure them properly:
#### 1. AppId
AppId is the identity for the application, which is a key information to retrieve the config from server.
AppId information should be put in
`classpath:/META-INF/app.properties`
with its key as
`app.id`
.
For example, you could place the file as the following screenshot:
![
app.properties example
](
doc/pic/app-id-location.png
)
And config the file as:
> app.id=YOUR-APP-ID
#### 2. Environment
Apollo supports config by multiple environments, so environment is another key information to retrieve the config from server.
Environment could be configured in 3 ways:
1.
As Java System Property
*
You could specify environment as java system property
`env`
*
For example, when starting the java application, it can be configured via
`-Denv=YOUR-ENVIRONMENT`
*
Please note the key should be lower case
2.
As OS System Environment
*
You could also specify environment as system environment
`ENV`
*
Please note the key should be UPPER CASE
3.
As Property File
*
You could create a file
`/opt/settings/server.properties`
on the target machine
*
And specify the environment in the file as
`env=YOUR-ENVIRONMENT`
*
Please note the key should be lower case
### I.II Optional Setup
#### Cluster
Apollo supports config separated by clusters, which means for one appId and one environment, you could have different configs.
If you need this functionality, you could specify the cluster as follows:
1.
As Java System Property
*
You could specify environment as java system property
`apollo.cluster`
*
For example, when starting the java application, it can be configured via
`-Dapollo.cluster=xxx`
*
Please note the key should be lower case
2.
As Property file
*
You could create a file
`/opt/settings/server.properties`
on the target machine
*
And specify the environment in the file as
`idc=xxx`
*
Please note the key should be lower case
##### Cluster Precedence
1.
If both
`apollo.cluster`
and
`idc`
are specified:
*
We will first try to load config from cluster specified as
`apollo.cluster`
*
If not found, we will fall back to cluster specified as
`idc`
*
If still not found, we will fall back to the default cluster
`default`
2.
If only
`apollo.cluster`
is specified:
*
We will first try to load config from cluster specified as
`apollo.cluster`
*
If not found, we will fall back to the default cluster
`default`
3.
If only
`idc`
is specified:
*
We will first try to load config from cluster specified as
`idc`
*
If not found, we will fall back to the default cluster
`default`
4.
If neither
`apollo.cluster`
nor
`idc`
is specified:
*
We will load config from the default cluster
`default`
## II. Maven Dependency
<dependency>
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo-client
</artifactId>
<version>
0.0.1
</version>
</dependency>
##
Client Usage
##
III.
Client Usage
### 1. Load config from default namespace(application)
```
java
...
...
apollo-client/doc/pic/app-id-location.png
0 → 100644
View file @
f0224e9c
12.4 KB
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