Projects tigase _server server-core Issues #311
Alternative to etc/init.properties and processing configuring service (#311)
Open
Andrzej Wójcik (Tigase) opened 1 decade ago

Maybe it would a good idea to provide alternative config file to etc/init.properties file. Currently we can set there anything we want, but when we set a property there it must be a string and we need to declare type of property using [I}, [L], [B] and other suffixes. This sometimes may create and issue as some properties may take a number as strings while other requires numbers.

That's why I'm suggesting to provide an alternative to etc/init.properties - we can use Groovy script (Groovy DSL) as our file which keeps configuration. This way after reading configuration we would get data in proper format. Moreover we could provide parameters in more readable way, ie:

c2s {
    processors {
        "urn:xmpp:sm:3" {
            "resumption-timeout" = 90
        }
    }
    "traffic-throttling"="xmpp:250k:0:disc,bin:2000m:0:disc"
}

instead of

c2s/processors[s]=urn:xmpp:sm:3
c2s/processors/urn\:xmpp\:sm\:3/resumption-timeout[I]=90
c2s/traffic-throttling=xmpp:250k:0:disc,bin:2000m:0:disc

I would also suggest to change setProperties(Map<String,Object> props) to something like setProperties(Config cfg) where Config class instance would have methods like getInteger(String key) and getString(String key) which will be responsible for converting values passed in configuration file to proper values if possible. So if variable port was passed in config file as a String and we would call getInteger("port") then this method should try to execute Integer.parseInt() if value would be of type other than Integer.

Artur Hefczyc commented 1 decade ago

I think this is something we talked with Bartek already, maybe there is a ticket for this as well. Bartek has offered to work on the new configuration framework :-)

issue 1 of 1
Type
Task
Priority
Blocker
Assignee
RedmineID
1918
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/server-core#311
Please wait...
Page is in error, reload to recover