Is it feasible to support something like below? [carbon.yaml]/transports/xyz/port = $sys->https.port
The big advantage is then we don't even need a file. Which is very useful when doing deployment automation. We can just do -Dcarbon-yaml.transports.xyz.port=443 or we can even do (this is how puppet factor works) follwing form bash export CARBON_carbon-yaml.transports.xyz.port=443 The cost is, we have to know the carbon.yaml's scema On Mon, Jun 13, 2016 at 5:09 AM, Shan Mahanama <[email protected]> wrote: > Hi all, > > We are going to add a *deployment.properties* file to C5 which will help > to override configuration data for various components. In current design, > many components have various configuration files located at various > locations. This makes things complicated if the end user only wants to > change few configurations. By implementing this new feature, whatever > changes that the user wants to make, he can change it using a single file. > More details are available at [1] mail thread. > > We are going to implement a utility class for this. This class will have 3 > public methods. > > 1) public static <T extends AbstractConfigFileType> T getConfig(File > file, Class<T> klass) > > This method will read configurations from a file, override configs > specified in *deployment.properties* file with new values and return the > new configurations wrapped in a XML,YML or Properties type(which was > provided as the 2nd argument) object. > > 2) public static <T extends AbstractConfigFileType> T > getConfig(FileInputStream > inputStream, String fileName, Class<T> klass) > > This method will read configurations from the provided > FileInputStream, override configs specified in *deployment.properties* > file with new values and return the new configurations wrapped in a XML,YML > or Properties type(which was provided as the 3rd argument) object. > > 3) public static String getConfig(String key) > > This method will return the new value from the deployment.properties > file which is associated with the given key. > > Component developers will use these 3 methods to get the overridden > configurations data(if any) and apply them to the components at run-time. > > As for the previous discussions[2], *deployment.properties* will support > xpath syntax. Ex - > > - > [log4j2.xml]/Configuration/Appenders/RandomAccessFile/PatternLayout/Pattern > = New_Pattern > - > [log4j2.xml]/Configuration/Appenders/RandomAccessFile[@name\='RandomAccessFile2']/PatternLayout/Pattern > = New_Pattern2 > - [log4j2.xml]/Configuration/Appenders/RandomAccessFile[3]/@name = > New_Name > > > This util will also support *$sys, $env, $sec* placeholders. Ex - > > [carbon.yml]/transports/transport[name\='xyz']/port = $sys->https.port > > > Thanks, > Shan. > > [1] [C5] Less configuration elements with meaningful defaults > [2] Invitation: Discussion on Deployment.properties file @ Thu Jun 9, 2016 > 11am - 12pm ([email protected]) > > -- > Shan Mahanama > Software Engineer, WSO2 Inc. http://wso2.com > <http://l.facebook.com/l.php?u=http%3A%2F%2Fwso2.com&h=gAQEswASa> > Email: [email protected] > Mobile: +94712000498 > > _______________________________________________ > Architecture mailing list > [email protected] > https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture > > -- With regards, *Manu*ranga Perera. phone : 071 7 70 20 50 mail : [email protected]
_______________________________________________ Architecture mailing list [email protected] https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
