diff --git a/examples/README.md b/examples/README.md index edfc946..f0ba1e9 100644 --- a/examples/README.md +++ b/examples/README.md @@ -7,3 +7,5 @@ wirklich nur um das API zu testen. ATM implementiert: machines::* & machine::rea 1. Daemon starten: `cargo run -- -c examples/bffh.dhall` 1. ??? 1. PROFIT! + +A dockerized version of this example can be found in the docker subdirectory \ No newline at end of file diff --git a/examples/docker/README.md b/examples/docker/README.md index f5f5313..2345940 100644 --- a/examples/docker/README.md +++ b/examples/docker/README.md @@ -1,10 +1,5 @@ # API-Testsetup, aber mit Docker -wirklich nur um das API zu testen. ATM implementiert: machine::read +wirklich nur um das API zu testen. ATM implementiert: machines::* & machine::read, authenticate -* Use included config.toml, or -* generate a sample config.toml by running "docker run registry.gitlab.com/fabinfra/fabaccess/bffh:dev-latest --print-default > config.toml". You may have to delete the ipv6 listen section. - 1. change mqtt-server hostname to `mqtt` in config.toml - 1. change machines path to `/etc/bffh/machines.toml` - -* run `docker-compose up` +* run `docker-compose up` in this directory \ No newline at end of file diff --git a/examples/docker/config/bffh.dhall b/examples/docker/config/bffh.dhall new file mode 100644 index 0000000..f3cf3f3 --- /dev/null +++ b/examples/docker/config/bffh.dhall @@ -0,0 +1,20 @@ +{ actor_connections = [{ _1 = "Testmachine", _2 = "Actor" }] +, actors = + { Actor = { module = "Shelly", params = {=} } + } +, init_connections = [{ _1 = "Initiator", _2 = "Testmachine" }] +, initiators = + { Initiator = { module = "Dummy", params = {=} } + } +, listens = [{ address = "::", 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" + } } +, mqtt_url = "tcp://mqtt:1883" +} diff --git a/examples/docker/config/pass.toml b/examples/docker/config/pass.toml new file mode 100644 index 0000000..6d4855d --- /dev/null +++ b/examples/docker/config/pass.toml @@ -0,0 +1 @@ +Testuser = "secret" diff --git a/examples/docker/config/roles.toml b/examples/docker/config/roles.toml new file mode 100644 index 0000000..cc61b71 --- /dev/null +++ b/examples/docker/config/roles.toml @@ -0,0 +1,20 @@ +[testrole] +name = "Testrole" +permissions = [ + "lab.test.*" +] + +[somerole] +name = "Somerole" +parents = ["testparent%lmdb"] +permissions = [ + "lab.some.admin" +] + +[testparent] +name = "Testparent" +permissions = [ + "lab.some.write", + "lab.some.read", + "lab.some.disclose", +] diff --git a/examples/docker/config/users.toml b/examples/docker/config/users.toml new file mode 100644 index 0000000..46c4a67 --- /dev/null +++ b/examples/docker/config/users.toml @@ -0,0 +1,11 @@ +[Testuser] +# Define them in roles.toml as well +roles = [] + +# If two or more users want to use the same machine at once the higher prio +# wins +priority = 0 + +# You can add whatever random data you want. +# It will get stored in the `kv` field in UserData. +noot = "noot!" diff --git a/examples/docker/docker-compose.yaml b/examples/docker/docker-compose.yaml index a4746b9..e2141b1 100644 --- a/examples/docker/docker-compose.yaml +++ b/examples/docker/docker-compose.yaml @@ -6,7 +6,7 @@ services: - "59661:59661" volumes: # generate a sample config.toml by running "docker run registry.gitlab.com/fabinfra/fabaccess/bffh:dev-latest --print-default > examples/config.toml" from the project root. You may have to delete the ipv6 listen section. - - "$PWD/../:/etc/bffh" + - "./config:/etc/bffh" links: - mqtt mqtt: