mirror of
https://github.com/evennia/evennia.git
synced 2026-03-24 08:46:31 +01:00
27 lines
630 B
Python
27 lines
630 B
Python
from apps.config.models import ConfigValue
|
|
import os
|
|
"""
|
|
Handle the setting/retrieving of server config directives.
|
|
"""
|
|
|
|
def host_os_is(osname):
|
|
"""
|
|
Check to see if the host OS matches the query.
|
|
"""
|
|
if os.name == osname:
|
|
return True
|
|
return False
|
|
|
|
def get_configvalue(configname):
|
|
"""
|
|
Retrieve a configuration value.
|
|
"""
|
|
return ConfigValue.objects.get(conf_key=configname).conf_value
|
|
|
|
def set_configvalue(configname, newvalue):
|
|
"""
|
|
Sets a configuration value with the specified name.
|
|
"""
|
|
conf = ConfigValue.objects.get(conf_key=configname)
|
|
conf.conf_value = newvalue
|
|
conf.save()
|