-
Notifications
You must be signed in to change notification settings - Fork 70
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
[WIP] support for Config files #14
Conversation
src/pbft-core/config.go
Outdated
@@ -41,10 +42,21 @@ type Config struct { | |||
NumKeys int // NumKeys is the count of IP addresses (BFT nodes) participating | |||
} | |||
|
|||
// LoadConfig ini file | |||
func LoadConfig() (configData *ini.File, err error) { | |||
configData, err = ini.Load("/home/abhishek/truechain/cfg.ini") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sure you're already working on eliminating this hardcoded path to the cfg.ini file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@samikshan yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@samikshan I have updated the PR.
src/cmds/main.go
Outdated
@@ -28,7 +28,7 @@ import ( | |||
func main() { | |||
|
|||
cfg := pbft.Config{} | |||
cfg.HostsFile = path.Join(os.Getenv("HOME"), "hosts") // TODO: read from config.yaml in future. | |||
cfg.HostsFile = path.Join(os.Getenv("PWD"), "hosts") // TODO: read from config.yaml in future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey, change this just like you did here? https://github.com/truechain/truechain-consensus-core/pull/14/files#diff-7bde18e8151279ab2e05cde5897db6f8R1220
I could be running from anywhere, conf resides in /etc/truechain/ (or something like that as default) and then change-able.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be ran from anywhere, log_folder
is just one of the field in the cnf.ini
file. The path defined on cfg.ini
can be anything like
[keys]
pem_keys = /tmp/truechain/keys
[log]
logs = /tmp/truechain/logs
or
[keys]
pem_keys = /etc/truechain/keys
[log]
logs = /etc/truechain/logs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, but it's not reading that from conf. Add an additional check (if not found in config, then read from PWD) ?
fe17262
to
238aef5
Compare
@arcolife made the changes. |
@procrypt some conflicts here.. also we have a config system now. Might wanna revisit this? Whaazzup |
@arcolife I'll update it as per the new config system 👍 |
@arcolife can you please point me to the new config system we have now. |
covering this in #57 (comment) (will wrap any commits in there so as to not loose the author. Example grafana/grafana@2fdda79) |
Fixes #13 I don't yet what all config options we are supporting yet so for now its is a WIP.
@arcolife @samikshan