def __init__(self, config_file): """se define unos path estándar en linux.""" self._config_file = config_file self._configuracion = Config(self._config_file) self.stdin_path = self._configuracion.show_value_item("paths", "null") self.stdout_path = self._configuracion.show_value_item( "paths", "stdout") self.stderr_path = self._configuracion.show_value_item( "paths", "stderr") #Se define la ruta del archivo pid del demonio. self.pidfile_path = self._configuracion.show_value_item( "paths", "pidfile") self.pidfile_timeout = int( self._configuracion.show_value_item("time", "timeout")) self.logfile = self._configuracion.show_value_item("paths", "logfile")
def config_file(self, config_file): """Setter de config_file""" self._config_file = config_file self._configuracion = Config(self._config_file) self._stdin_path = self._configuracion.show_value_item("paths", "null") self._stdout_path = self._configuracion.show_value_item( "paths", "stdout") self._stderr_path = self._configuracion.show_value_item( "paths", "stderr") #Se define la ruta del archivo pid del demonio. self._pidfile_path = self._configuracion.show_value_item( "paths", "pidfile") self._pidfile_timeout = int( self._configuracion.show_value_item("time", "timeout")) self._logfile = self._configuracion.show_value_item("paths", "logfile")
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from pywrapper_config import Config config = Config("./conf-examples/tests.conf") print(config.show_sections()) print(config.show_sectionsJSON()) print(config.show_item_section('server')) print(config.show_item_sectionJSON('server')) print(config.show_value_item('server', 'ip')) print(config.show_value_itemJSON('server', 'ip'))