Closed ghost closed 6 years ago
hi, in the latest version 0.3.6, you could create a new backend with the following codes.
# Firlst, parse the file to create config.Configuration instance
self.parser = parse.Parser(filestring=filestring)
self.configuration = self.parser.build_configuration()
# Second, create a new config.Backend instance
new_be = config.Backend('new_backend', [])
# you could add option/config/server/user lines, which are the compositions of config-block
new_be.add_option(config.Option('timeout', ''))
# Finally, append the newly created
self.configration.backends.append(new_be)
// Now the `self.configuration` object contains the new backend instance
self.render = render.Render(self.configration)
self.render.dumps_to('./hatest.cfg')
Maybe the usage is unidiomatic. I should have set an empty list as the default value of config_block
parameter when creating the config.Backend
instance. What do you think? please let me know.
Thanks!
Using the examples it's unclear how to create a new backend.