Renamed .ini files to .conf. Look more familiar to me. Some fixes too.
This commit is contained in:
parent
74e13d1037
commit
98fa44f6ff
9 changed files with 17 additions and 12 deletions
|
|
@ -8,7 +8,7 @@ log_count = 5
|
|||
log_size = 10485760
|
||||
pid_file = /var/run/user/1000/linspector.pid
|
||||
; plugins separated by ','. no whitespaces allowed
|
||||
plugins = HTTPServer
|
||||
plugins = Lish
|
||||
; globally configured tasks will always run on all monitors when no task is configured there. if tasks are configured in
|
||||
; a monitor then maybe only run tasks from the dedicated monitor. maybe it is a good idea to run global tasks in every
|
||||
; monitor and the monitor can add tasks to the global settings... need to think about it.
|
||||
|
|
@ -39,9 +39,9 @@ class Configuration:
|
|||
self.__configuration_path = configuration_path
|
||||
self.__environment = environment
|
||||
|
||||
if os.path.isfile(configuration_path + '/linspector.ini'):
|
||||
if os.path.isfile(configuration_path + '/linspector.conf'):
|
||||
try:
|
||||
self.__configuration.read(configuration_path + '/linspector.ini', 'utf-8')
|
||||
self.__configuration.read(configuration_path + '/linspector.conf', 'utf-8')
|
||||
except Exception as err:
|
||||
raise Exception('something went wrong reading the configuration file '
|
||||
'linspector.ini in the configuration root path! ({0})'.format(err))
|
||||
|
|
@ -55,7 +55,7 @@ class Configuration:
|
|||
if not self.__configuration.has_section(target_section):
|
||||
self.__configuration.add_section(target_section)
|
||||
|
||||
section_list = glob.glob(configuration_path + '/' + target_section + '/*.ini')
|
||||
section_list = glob.glob(configuration_path + '/' + target_section + '/*.conf')
|
||||
for section_file in section_list:
|
||||
#print(__file__ + ' (60): ' + section_file)
|
||||
configuration = configparser.ConfigParser()
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class Monitors:
|
|||
monitor_configuration = configparser.ConfigParser()
|
||||
for monitor_group in monitor_groups:
|
||||
monitors_file_list = glob.glob(self.__configuration.get_configuration_path() +
|
||||
'/monitors/' + monitor_group + '/*.ini')
|
||||
'/monitors/' + monitor_group + '/*.conf')
|
||||
|
||||
for monitor_file in monitors_file_list:
|
||||
monitor_configuration.read(monitor_file, 'utf-8')
|
||||
|
|
|
|||
|
|
@ -29,16 +29,17 @@ from logging import getLogger
|
|||
logger = getLogger('linspector')
|
||||
|
||||
|
||||
def get(configuration, environment):
|
||||
return HTTPServerPlugin(configuration, environment)
|
||||
def get(configuration, environment, linspector):
|
||||
return HTTPServerPlugin(configuration, environment, linspector)
|
||||
|
||||
|
||||
# TODO: check for all required configuration options and set defaults if needed.
|
||||
class HTTPServerPlugin:
|
||||
|
||||
def __init__(self, configuration, environment):
|
||||
def __init__(self, configuration, environment, linspector):
|
||||
self.__configuration = configuration
|
||||
self.__environment = environment
|
||||
self.__linspector = linspector
|
||||
|
||||
@cherrypy.expose
|
||||
def index(self):
|
||||
|
|
@ -68,7 +69,7 @@ class HTTPServerPlugin:
|
|||
def playground(self):
|
||||
return 'My Playground!'
|
||||
|
||||
def run_server(self):
|
||||
def run(self):
|
||||
conf = {
|
||||
'/': {
|
||||
# 'tools.sessions.on': True,
|
||||
|
|
|
|||
|
|
@ -26,13 +26,17 @@ from logging import getLogger
|
|||
logger = getLogger('linspector')
|
||||
|
||||
|
||||
def get(configuration, environment):
|
||||
return LishPlugin(configuration, environment)
|
||||
def get(configuration, environment, linspector):
|
||||
return LishPlugin(configuration, environment, linspector)
|
||||
|
||||
|
||||
# TODO: check for all required configuration options and set defaults if needed.
|
||||
class LishPlugin:
|
||||
|
||||
def __init__(self, configuration, environment):
|
||||
def __init__(self, configuration, environment, linspector):
|
||||
self.__configuration = configuration
|
||||
self.__environment = environment
|
||||
self.__linspector = linspector
|
||||
|
||||
def run(self):
|
||||
print('hello from Lish!')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue