Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Env from database #2953

Merged
merged 2 commits into from
Mar 14, 2020
Merged

Env from database #2953

merged 2 commits into from
Mar 14, 2020

Conversation

Anilople
Copy link
Contributor

What's the purpose of this PR

In PR #2867, discussion_r363044605

I think we can keep it as add environment in portal when start up, but we support configuring it via System Configuration page, e.g. we add a new configuration item like apollo.portal.meta.servers to store the mapping between env and meta server address.

We will still keep the apollo.portal.envs as it indicates the active environments so that there may be 3 environment mappings in apollo.portal.meta.servers but only 2 active envs in apollo.portal.envs.

If this involves much more effort, then it's okay to leave it when we support add environment in portal when running.

That is this PR doing.

Now user can add their own meta server address in PortalDB.ServerConfig with key apollo.portal.meta.servers value like follow.

{
	"local" : "http://localhost:8080",
	"dev" : "http://dev.com:8080",
	"self-define" : "http://self-define.com:port"
}

When portal start, the value will be read to com.ctrip.framework.apollo.portal.component.config.PortalConfig, then class com.ctrip.framework.apollo.portal.environment.DatabasePortalMetaServerProvider will use those informations.

Which issue(s) this PR fixes:

None.

Brief changelog

The main change under package com.ctrip.framework.apollo.portal.environment.

For add this feature, some constant thing to be dynamic.

  1. com.ctrip.framework.apollo.portal.environment.PortalMetaServerProvider from class to an interface. This is for multiple meta server providers ( special for data from the database, i.e com.ctrip.framework.apollo.portal.environment.DatabasePortalMetaServerProvider ).

  2. PortalMetaDomainConsts -> PortalMetaDomainService. A constant class to a service, and add multi server providers when the service constructing. Use this service instead old one without change methods

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Read the Contributing Guide before making this pull request.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit tests to verify the code.
  • Run mvn clean test to make sure this pull request doesn't break anything.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 54.926% when pulling 472114c on Anilople:env-from-database into 0769c80 on ctripcorp:master.

Copy link
Member

@nobodyiam nobodyiam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! There are some places which need some modifications, but it looks to me overall. So I will merge this pull request and post a new pull request for those minor modifications.

@nobodyiam nobodyiam merged commit a81d728 into apolloconfig:master Mar 14, 2020
@nobodyiam nobodyiam added this to the 1.6.0 milestone Mar 14, 2020
@Anilople Anilople added area/portal apollo-portal feature Categorizes issue as related to a new feature. labels Dec 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/portal apollo-portal feature Categorizes issue as related to a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants