Skip to content

Commit

Permalink
Merge pull request #737 from aionnetwork/fix-config
Browse files Browse the repository at this point in the history
Minor corrections for log path and fork file path
  • Loading branch information
qoire authored Nov 29, 2018
2 parents 2cfa29c + 4da7bb1 commit a0b68b7
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 20 deletions.
7 changes: 6 additions & 1 deletion modAionImpl/src/org/aion/zero/impl/cli/Cli.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,12 @@ public ReturnType call(final String[] args, Cfg cfg) {
configFile = cfg.getInitialConfigFile();
} else {
// marks that the files were read from the execution path
cfg.setReadConfigFiles(configFile, cfg.getExecGenesisFile());
File forkFile = cfg.getExecForkFile();
if (forkFile.exists()) {
cfg.setReadConfigFiles(configFile, cfg.getExecGenesisFile(), forkFile);
} else {
cfg.setReadConfigFiles(configFile, cfg.getExecGenesisFile());
}
}

// reading from correct fork file
Expand Down
7 changes: 1 addition & 6 deletions modBoot/src/org/aion/Aion.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,7 @@ public static void main(String args[]) {
System.out.println(
"Logger disabled; to enable please update log settings in config.xml and restart kernel.");
filePath[0] = "« disabled »";
} else if (!cfg.getLog().isValidPath() && cfg.getLog().getLogFile()) {
System.out.println(
"Logger disabled due to invalid file path; to enable please update log setting in config.xml and restart kernel.");
cfg.getLog().disableLogging();
filePath[0] = "« disabled »";
} else if (cfg.getLog().isValidPath() && cfg.getLog().getLogFile()) {
} else {
filePath[0] = cfg.getLogPath();
}

Expand Down
5 changes: 1 addition & 4 deletions modGui/src/org/aion/AionGraphicalFrontEnd.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ public static void main(String args[]) {
if (!cfg.getLog().getLogFile()) {
System.out.println(
"Logger disabled; to enable please check log settings in config.xml\n");
} else if (!cfg.getLog().isValidPath() && cfg.getLog().getLogFile()) {
System.out.println("File path is invalid; please check log setting in config.xml\n");
System.exit(1);
} else if (cfg.getLog().isValidPath() && cfg.getLog().getLogFile()) {
} else {
System.out.println("Logger file path: '" + cfg.getLog().getLogPath() + "'\n");
}
AionLoggerFactory.init(
Expand Down
5 changes: 1 addition & 4 deletions modGui/src/org/aion/gui/controller/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,7 @@ private void initLogger(CfgAion cfg) {
if (!cfg.getLog().getLogFile()) {
System.out.println(
"Logger disabled; to enable please check log settings in config.xml\n");
} else if (!cfg.getLog().isValidPath() && cfg.getLog().getLogFile()) {
System.out.println("File path is invalid; please check log setting in config.xml\n");
System.exit(1);
} else if (cfg.getLog().isValidPath() && cfg.getLog().getLogFile()) {
} else {
System.out.println("Logger file path: '" + cfg.getLog().getLogPath() + "'\n");
}
AionLoggerFactory.init(
Expand Down
9 changes: 9 additions & 0 deletions modMcf/src/org/aion/mcf/config/Cfg.java
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,15 @@ public void setReadConfigFiles(File configFile, File genesisFile) {
this.baseGenesisFile = genesisFile;
}

/**
* Used to updated the initial configuration to using the execution configuration files when
* reading the initial configuration from those files.
*/
public void setReadConfigFiles(File configFile, File genesisFile, File forkFile) {
setReadConfigFiles(configFile, genesisFile);
this.baseForkFile = forkFile;
}

/** @implNote Maintains the old setup if the genesis file is present in the old location. */
public File getInitialGenesisFile() {
if (baseGenesisFile == null) {
Expand Down
6 changes: 1 addition & 5 deletions modMcf/src/org/aion/mcf/config/CfgLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
public class CfgLog {

private Map<String, String> modules;
// TODO: rename to enabled; current name leads to confusion
boolean logFile;
String logPath;

Expand Down Expand Up @@ -171,11 +172,6 @@ public String getLogPath() {
return logPath;
}

/** Method checks folder path for illegal inputs */
public boolean isValidPath() {
return logPath.length() > 0 && !logPath.matches(".*[-=+,.?;:'!@#$%^&*].*");
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand Down

0 comments on commit a0b68b7

Please sign in to comment.