diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..577624e48b4f5e45ceb3262badf4b54579b4e184 --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +config-schema.dhall: config.dhall.sample + dhall type < config.dhall.sample > config-schema.dhall diff --git a/config-schema.dhall b/config-schema.dhall new file mode 100644 index 0000000000000000000000000000000000000000..08696aa958c7b29968e7096090ce5046675b16a8 --- /dev/null +++ b/config-schema.dhall @@ -0,0 +1,46 @@ +{ activation_amount : Natural +, adr : Text +, bandwidth_peer : Text +, bandwidth_site : Text +, braintree : + { environment : Text + , merchant_accounts : { CAD : Text, USD : Text } + , merchant_id : Text + , private_key : Text + , public_key : Text + } +, catapult : + { application_id : Text + , domain : Text + , secret : Text + , sip_host : Text + , token : Text + , user : Text + } +, component : { jid : Text, secret : Text } +, credit_card_url : forall (jid : Text) -> forall (customer_id : Text) -> Text +, creds : { account : Text, password : Text, username : Text } +, electrum : { rpc_password : Text, rpc_uri : Text, rpc_username : Text } +, electrum_notify_url : + forall (address : Text) -> forall (customer_id : Text) -> Text +, interac : Text +, notify_admin : Text +, notify_from : Text +, oxr_app_id : Text +, payable : Text +, plans : + List + { currency : < CAD | USD > + , messages : + < limited : { included : Natural, price : Natural } | unlimited > + , minutes : + < limited : { included : Natural, price : Natural } | unlimited > + , monthly_price : Natural + , name : Text + } +, server : { host : Text, port : Natural } +, sgx : Text +, sip_host : Text +, web_register : { from : Text, to : Text } +, xep0157 : List { label : Text, value : Text, var : Text } +} diff --git a/config.dhall.sample b/config.dhall.sample index 421a1ae957378a475b462727ec0dead98c5b1196..149e619cb1370ee2061a9f347aaaebd3f5997204 100644 --- a/config.dhall.sample +++ b/config.dhall.sample @@ -38,7 +38,7 @@ } }, xep0157 = [ - { var = "support-addresses", value = "xmpp:+14169938000@cheogram.com" } + { var = "support-addresses", value = "xmpp:+14169938000@cheogram.com", label = "Support" } ], notify_admin = "muc@example.com", sip_host = "sip.jmp.chat", diff --git a/sgx_jmp.rb b/sgx_jmp.rb index 43ece2fa120fb335982958812e45a5d4359b9ff1..20f054375937e2c32eadca4e4e7f55aa7322d00a 100644 --- a/sgx_jmp.rb +++ b/sgx_jmp.rb @@ -48,7 +48,10 @@ LOG.extend SentryOugai CONFIG = Dhall::Coder .new(safe: Dhall::Coder::JSON_LIKE + [Symbol, Proc]) - .load(ARGV[0], transform_keys: ->(k) { k&.to_sym }) + .load( + "(#{ARGV[0]}) : #{__dir__}/config-schema.dhall", + transform_keys: ->(k) { k&.to_sym } + ) singleton_class.class_eval do include Blather::DSL