moved config values to simple service from default route, fixed coretk issue with config service config data

This commit is contained in:
Blake Harnden 2020-01-21 12:04:22 -08:00
parent 80a4955bd4
commit 1ca3b0e3f4
3 changed files with 15 additions and 9 deletions

View file

@ -1,4 +1,6 @@
from core.config import Configuration
from core.configservice.base import ConfigService, ConfigServiceMode
from core.emulator.enumerations import ConfigDataTypes
class SimpleService(ConfigService):
@ -12,18 +14,24 @@ class SimpleService(ConfigService):
validate = []
shutdown = []
validation_mode = ConfigServiceMode.BLOCKING
default_configs = []
default_configs = [
Configuration(_id="value1", _type=ConfigDataTypes.STRING, label="Value 1"),
Configuration(_id="value2", _type=ConfigDataTypes.STRING, label="Value 2"),
Configuration(_id="value3", _type=ConfigDataTypes.STRING, label="Value 3"),
]
def get_text(self, name: str) -> str:
if name == "test1.sh":
return """
# sample script 1
# node id(${node.id}) name(${node.name})
# config: ${config}
echo hello
"""
elif name == "test2.sh":
return """
# sample script 2
# node id(${node.id}) name(${node.name})
# config: ${config}
echo hello2
"""