gtrianta1965 / ServiceWatcher

Standalone java application for Service Monitoring
0 stars 0 forks source link

If multiple configuration files specified (with -conf option) use static parameters from the first and merge services from all of them. Read more.... #28

Closed gtrianta1965 closed 7 years ago

gtrianta1965 commented 7 years ago

Team,

It might be convinient for someone to seperate her services in different configuration files and wants to run all of them. Imagine the following:

Mary works in a company and monitors three different environments. The development, test and production. She has three seperate configuration files as she doesn't want to include them all in one config (Development environment sometimes is down).

But there are times that she would like to monitor all of them. She gave me a call yesterday and she asked me if it is possible to do it. I told her that she can merge all of them using an editor in another configuration file (e.g. dev-uat-prod-config.properties).

But this is a workaround as she will soon discover that everytime she changes one of the original configurations, another "merge" should be performed to include the newly added services. Otherwise the dev-uat-prod-config.properties will become obsolete.

So I thought that it would be a good idea to auto merge services from different configurations. For example:

sw -conf:dev-config.properties -conf:test-config.properties -conf:prod-config.properties -nogui

Give it a though

KALALEX commented 7 years ago

I was thinking of something like this.

FileStream file = "";
List<String> confFileNames;
for (String aName : -conf){
    confFileNames.add(aName);
}

if (confFileNames.length > 1){
    for (String aConf : confFileNames){
        file += println(aConf + "\n");
    }
}

setConf(file);

Maybe it could be something to be added in the generic utils class or make a class called FileUtils and move all file functions from orchestrator to FileUtils.

magVarv commented 7 years ago

I thought about a pathSeparator (-conf:....... : ...... : ....... )instead of writhing -conf:... -conf:.....
e.g. System.out.println(File.pathSeparator); File fileproperties= new File("tmp"+File.pathSeparator+getConfigFile());

KALALEX commented 7 years ago

resolved in branch readmultipleconfigfiles