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

Feature load environment config #851



5 participants
Copy link

commented Jun 21, 2019

load environmental config filles for NEO3 .

Ashuaidehao added some commits Mar 11, 2019


This comment has been minimized.

Copy link

commented Jun 21, 2019

Codecov Report

Merging #851 into master will increase coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #851      +/-   ##
+ Coverage    38.7%   38.73%   +0.03%     
  Files         176      176              
  Lines       12482    12489       +7     
+ Hits         4831     4838       +7     
  Misses       7651     7651
Impacted Files Coverage Δ
neo/ProtocolSettings.cs 94% <100%> (ø) ⬆️
neo/Helper.cs 47.05% <100%> (+1.88%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dfed8ba...1ce3f1e. Read the comment docs.

var env = Environment.GetEnvironmentVariable("NEO_NETWORK");
var configFile = string.IsNullOrWhiteSpace(env) ? $"{config}.json" : $"{config}.{env}.json";
Plugin.Log(nameof(LoadConfig), LogLevel.Info, $"Config loading:{configFile}");

This comment has been minimized.

Copy link

erikzhang Jun 21, 2019


I prefer to remove this line. Because this is a common method, this can cause the logs to become confusing. The caller should log by itself.

This comment has been minimized.

Copy link

Ashuaidehao Jun 22, 2019

Author Contributor

Sure,I've removed it.

Copy link

left a comment

Even protocol.json would be loadded like this, right?

Is this in connection with #845?
Can you provide more details about the design, @Ashuaidehao. I did not understand it very well.


This comment has been minimized.

Copy link
Contributor Author

commented Jun 21, 2019

@vncoelho ,it use a enviroment variable to control which config file should be used .
I has write a simple program to show how it works:

It would be useful to use this feature load both "config.json" and "protocol.json" .

Ashuaidehao and others added some commits Jun 22, 2019

@erikzhang erikzhang merged commit 87ea7c6 into neo-project:master Jun 22, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed

KickSeason added a commit to KickSeason/neo that referenced this pull request Jul 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.