From 7d19bc6a036b6d8c51b3bf447de44d7545e4fe83 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Sat, 25 Sep 2021 15:50:45 +0200 Subject: [PATCH] split cfg --- examples/actors.dhall | 11 +++++ examples/bffh.dhall | 84 ++++++------------------------------ examples/initiators.dhall | 1 + examples/machines.dhall | 28 ++++++++++++ examples/roles.dhall | 14 ++++++ examples/types/Machine.dhall | 15 +++++++ 6 files changed, 83 insertions(+), 70 deletions(-) create mode 100644 examples/actors.dhall create mode 100644 examples/initiators.dhall create mode 100644 examples/machines.dhall create mode 100644 examples/roles.dhall create mode 100644 examples/types/Machine.dhall diff --git a/examples/actors.dhall b/examples/actors.dhall new file mode 100644 index 0000000..495d552 --- /dev/null +++ b/examples/actors.dhall @@ -0,0 +1,11 @@ +{ Shelly_1234 = { module = "Shelly", params = {=} } +, Bash = + { module = "Process" + , params = { cmd = "./examples/actor.sh", args = "your ad could be here" } + } +, Bash2 = + { module = "Process" + , params = { cmd = "./examples/actor.sh", args = "this is a different one" } + } +, FailBash = { module = "Process", params.cmd = "./examples/fail-actor.sh" } +} diff --git a/examples/bffh.dhall b/examples/bffh.dhall index 308f19f..4a0f025 100644 --- a/examples/bffh.dhall +++ b/examples/bffh.dhall @@ -1,76 +1,20 @@ --- { actor_connections = [] : List { _1 : Text, _2 : Text } -{ actor_connections = - -- Link up machines to actors - [ { _1 = "Testmachine", _2 = "Shelly_1234" } - , { _1 = "Another", _2 = "Bash" } - -- One machine can have as many actors as it wants - , { _1 = "Yetmore", _2 = "Bash2" } - , { _1 = "Yetmore", _2 = "FailBash"} - ] -, actors = - { Shelly_1234 = { module = "Shelly", params = {=} } - , Bash = { module = "Process", params = - { cmd = "./examples/actor.sh" - , args = "your ad could be here" - }} - , Bash2 = { module = "Process", params = - { cmd = "./examples/actor.sh" - , args = "this is a different one" - }} - , FailBash = { module = "Process", params = - { cmd = "./examples/fail-actor.sh" - }} - } - , init_connections = [] : List { _1 : Text, _2 : Text } ---, init_connections = [{ _1 = "Initiator", _2 = "Testmachine" }] -, initiators = {=} - --{ Initiator = { module = "Dummy", params = {=} } } -, listens = +{ actor_connections = + -- Link up machines to actors + [ { _1 = "Testmachine", _2 = "Shelly_1234" } + , { _1 = "Another", _2 = "Bash" } + , { _1 = "Yetmore", _2 = "Bash2" } + , { _1 = "Yetmore", _2 = "FailBash" } + ] +, actors = ./actors.dhall +, init_connections = [] : List { _1 : Text, _2 : Text } +, initiators = ./initiators.dhall +, listens = [ { address = "127.0.0.1", port = Some 59661 } , { address = "::1", port = Some 59661 } , { address = "192.168.0.114", port = Some 59661 } ] -, machines = - { Testmachine = - { description = Some "A test machine" - , disclose = "lab.test.read" - , manage = "lab.test.admin" - , name = "Testmachine" - , read = "lab.test.read" - , write = "lab.test.write" - }, - Another = - { description = Some "Another test machine" - , disclose = "lab.test.read" - , manage = "lab.test.admin" - , name = "Another" - , read = "lab.test.read" - , write = "lab.test.write" - }, - Yetmore = - { description = Some "Yet more test machines" - , disclose = "lab.test.read" - , manage = "lab.test.admin" - , name = "Yetmore" - , read = "lab.test.read" - , write = "lab.test.write" - } - } -, mqtt_url = "tcp://localhost:1883" +, machines = ./machines.dhall , db_path = "/tmp/bffh" -, roles = - { testrole = - { permissions = [ "lab.test.*" ] } - , somerole = - { parents = ["testparent"] - , permissions = [ "lab.some.admin" ] - } - , testparent = - { permissions = - [ "lab.some.write" - , "lab.some.read" - , "lab.some.disclose" - ] - } - } +, roles = ./roles.dhall +, mqtt_url = "tcp://localhost:1883" } diff --git a/examples/initiators.dhall b/examples/initiators.dhall new file mode 100644 index 0000000..339130f --- /dev/null +++ b/examples/initiators.dhall @@ -0,0 +1 @@ +{=} diff --git a/examples/machines.dhall b/examples/machines.dhall new file mode 100644 index 0000000..6a145eb --- /dev/null +++ b/examples/machines.dhall @@ -0,0 +1,28 @@ +{ Testmachine = + { description = Some "A test machine" + , name = "Textmachine" + + , manage = "lab.test.admin" + , read = "lab.test.read" + , write = "lab.test.write" + , disclose = "lab.test.read" + } +, Another = + { description = Some "Another test machine" + , name = "Another" + + , disclose = "lab.test.read" + , manage = "lab.test.admin" + , read = "lab.test.read" + , write = "lab.test.write" + }, + Yetmore = + { description = Some "Yet more test machines" + , name = "Yetmore" + + , disclose = "lab.test.read" + , manage = "lab.test.admin" + , read = "lab.test.read" + , write = "lab.test.write" + } +} diff --git a/examples/roles.dhall b/examples/roles.dhall new file mode 100644 index 0000000..75a4d4b --- /dev/null +++ b/examples/roles.dhall @@ -0,0 +1,14 @@ +{ testrole = + { permissions = [ "lab.test.*" ] } +, somerole = + { parents = ["testparent"] + , permissions = [ "lab.some.admin" ] + } +, testparent = + { permissions = + [ "lab.some.write" + , "lab.some.read" + , "lab.some.disclose" + ] + } +} diff --git a/examples/types/Machine.dhall b/examples/types/Machine.dhall new file mode 100644 index 0000000..c48c85f --- /dev/null +++ b/examples/types/Machine.dhall @@ -0,0 +1,15 @@ +let Map = https://prelude.dhall-lang.org/v20.2.0/Map/Type + sha256:210c7a9eba71efbb0f7a66b3dcf8b9d3976ffc2bc0e907aadfb6aa29c333e8ed + +let Machine = + { Type = + { description : Optional Text + , manage : Text + , write : Text + , read : Text + , disclose : Text + } + , default = { description = None } + } + +in Machine