wip
This commit is contained in:
parent
33320a7c8c
commit
e799cf8c6c
2 changed files with 75 additions and 6 deletions
|
@ -1,3 +1,66 @@
|
||||||
|
c = '''##################### Grafana Configuration Example #####################
|
||||||
|
#
|
||||||
|
# Everything has defaults so you only need to uncomment things you want to
|
||||||
|
# change
|
||||||
|
|
||||||
|
# possible values : production, development
|
||||||
|
;app_mode = production
|
||||||
|
|
||||||
|
# instance name, defaults to HOSTNAME environment variable value or hostname if HOSTNAME var is empty
|
||||||
|
;instance_name = ${HOSTNAME}
|
||||||
|
|
||||||
|
#################################### Paths ####################################
|
||||||
|
[paths]
|
||||||
|
# Path to where grafana can store temp files, sessions, and the sqlite3 db (if that is used)
|
||||||
|
;data = /var/lib/grafana
|
||||||
|
|
||||||
|
# Temporary files in `data` directory older than given duration will be removed
|
||||||
|
;temp_data_lifetime = 24h
|
||||||
|
|
||||||
|
# Directory where grafana can store logs
|
||||||
|
;logs = /var/log/grafana
|
||||||
|
|
||||||
|
# Directory where grafana will automatically scan and look for plugins
|
||||||
|
;plugins = /var/lib/grafana/plugins
|
||||||
|
|
||||||
|
# folder that contains provisioning config files that grafana will apply on startup and while running.
|
||||||
|
;provisioning = conf/provisioning
|
||||||
|
|
||||||
|
#################################### Server ####################################
|
||||||
|
[server]
|
||||||
|
# Protocol (http, https, h2, socket)
|
||||||
|
;protocol = http
|
||||||
|
|
||||||
|
# The ip address to bind to, empty will bind to all interfaces
|
||||||
|
;http_addr =
|
||||||
|
|
||||||
|
# The http port to use
|
||||||
|
;http_port = 3000
|
||||||
|
|
||||||
|
# The public facing domain name used to access grafana from a browser
|
||||||
|
;domain = localhost
|
||||||
|
|
||||||
|
# Redirect to correct domain if host header does not match domain
|
||||||
|
# Prevents DNS rebinding attacks
|
||||||
|
;enforce_domain = false
|
||||||
|
|
||||||
|
# The full public facing url you use in browser, used for redirects and emails
|
||||||
|
# If you use reverse proxy and sub path specify full url (with sub path)
|
||||||
|
;root_url = %(protocol)s://%(domain)s:%(http_port)s/
|
||||||
|
|
||||||
|
# Serve Grafana from subpath specified in `root_url` setting. By default it is set to `false` for compatibility reasons.
|
||||||
|
;serve_from_sub_path = false
|
||||||
|
|
||||||
|
# Log web requests
|
||||||
|
;router_logging = false
|
||||||
|
|
||||||
|
# the path relative working path
|
||||||
|
;static_root_path = public
|
||||||
|
|
||||||
|
# enable gzip
|
||||||
|
;enable_gzip = false
|
||||||
|
'''
|
||||||
|
|
||||||
files['/etc/grafana/test'] = {
|
files['/etc/grafana/test'] = {
|
||||||
'content': repo.libs.ini.dumps({'HALLO': {'was': 'itlos', 'ich': 123}, 'YO': {}}),
|
'content': repo.libs.ini.dumps(repo.libs.ini.parse(c)),
|
||||||
}
|
}
|
||||||
|
|
16
libs/ini.py
16
libs/ini.py
|
@ -1,17 +1,23 @@
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
|
def parse(text):
|
||||||
|
config = ConfigParser()
|
||||||
|
config.read_string(text)
|
||||||
|
|
||||||
|
return {
|
||||||
|
section: dict(config.items(section))
|
||||||
|
for section in config.sections()
|
||||||
|
}
|
||||||
|
|
||||||
class Writable():
|
class Writable():
|
||||||
data = ''
|
data = ''
|
||||||
|
|
||||||
def write(self, line):
|
def write(self, line):
|
||||||
self.data += line
|
self.data += line
|
||||||
|
|
||||||
def dumps(dict):
|
def dumps(dict):
|
||||||
config = ConfigParser()
|
config = ConfigParser()
|
||||||
|
config.read_dict(dict)
|
||||||
for section, settings in dict.items():
|
|
||||||
config[section] = settings
|
|
||||||
|
|
||||||
writable = Writable()
|
writable = Writable()
|
||||||
config.write(writable)
|
config.write(writable)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue