split cfg

This commit is contained in:
Nadja Reitzenstein 2021-09-25 15:50:45 +02:00
parent 04d3c5d267
commit 2cc7a800f5
6 changed files with 83 additions and 70 deletions

11
examples/actors.dhall Normal file
View File

@ -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" }
}

View File

@ -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 = {=} } }
-- 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"
}

View File

@ -0,0 +1 @@
{=}

28
examples/machines.dhall Normal file
View File

@ -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"
}
}

14
examples/roles.dhall Normal file
View File

@ -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"
]
}
}

View File

@ -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