From 5d1aee75c1c1b434c1a8a3f87f345f82f1efde09 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sun, 19 Dec 2021 11:13:52 +0000 Subject: config file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit wanted to use `Config`, but its `Config::Parser::toml` refers to `Config::TOML` with a `:auth<>` that zef can't match… --- META6.json | 1 + config.toml | 6 ++++++ vlc.raku | 13 +++++++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 config.toml diff --git a/META6.json b/META6.json index 7de91a9..3a18ec3 100644 --- a/META6.json +++ b/META6.json @@ -2,6 +2,7 @@ "perl": "6.d", "name": "Vlc::Control", "depends": [ + "Config::TOML", "Cro::BodyParser", "Cro::HTTP::Client", "Cro::HTTP::Message", diff --git a/config.toml b/config.toml new file mode 100644 index 0000000..cc23482 --- /dev/null +++ b/config.toml @@ -0,0 +1,6 @@ +[vlc] +password = "ginopino" +base-uri = "http://127.0.0.1:8080/requests/" + +[server] +port = 8090 diff --git a/vlc.raku b/vlc.raku index 1d93dd2..00b65bc 100644 --- a/vlc.raku +++ b/vlc.raku @@ -1,12 +1,21 @@ #!/usr/bin/env rakudo use v6.d; use lib 'inst#local','file#lib'; +use Config::TOML; use Vlc::Client; use Vlc::App; -my Vlc::Client $vlc .= new(:password,:base-uri); +my $config = from-toml(file=>'config.toml'); -my Vlc::App $app .= new(:port(8080), :$vlc); +my Vlc::Client $vlc .= new( + password => $config, + base-uri => $config, +); + +my Vlc::App $app .= new( + port => $config, + :$vlc, +); $app.start; -- cgit v1.2.3