robocop

Checks KYC attributes against sanction lists
Log | Files | Refs | Submodules | README | LICENSE

commit 6a8a415d4d270ef47656f4df84154fe2dccde7d6
parent a148ae110e549d9222a9bca2e79a23c4b94b998a
Author: Vint Leenaars <vl.software@leenaa.rs>
Date:   Fri,  9 May 2025 01:09:49 +0200

Allow custom config file + add example

Diffstat:
MREADME.md | 2+-
Mapp/Main.hs | 8++++----
Akycheck.example.conf | 27+++++++++++++++++++++++++++
Msrc/KYCheck/Config.hs | 5+++++
Msrc/KYCheck/Type.hs | 1+
5 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md @@ -73,7 +73,7 @@ If there are multiple entries that match, kycheck will print these so you can in Enter new lines with subject data until you've researched all. -You can exit the application by typing the word 'quit' and pressing enter, or by pressing <ctrl> C. +You can exit the application by typing the word 'quit' and pressing enter, or by pressing &gt;ctrl&gt; C. ## Testing diff --git a/app/Main.hs b/app/Main.hs @@ -3,8 +3,6 @@ -- SPDX-License-Identifier: AGPL-3.0-or-later -- SPDX-License-Identifier: EUPL-1.2 -{-# LANGUAGE OverloadedStrings #-} - module Main (main) where import Control.Exception @@ -47,13 +45,15 @@ main :: IO () main = do cl <- execParser opts + let config_fp = cl_config_location cl + case cl_verbosity cl of Nothing -> return () Just Silent -> return () Just _ -> do curr_dir <- getCurrentDirectory - putStrLn $ "Searching for 'kycheck.conf in " ++ curr_dir + putStrLn $ "Searching for '" ++ config_fp ++ "' in " ++ curr_dir - dhall <- input auto "./kycheck.conf" :: IO DhallConfig + dhall <- input auto $ T.pack $ "./" ++ config_fp :: IO DhallConfig let config = inputToConfig dhall $ Just cl valid_config <- checkConfig config diff --git a/kycheck.example.conf b/kycheck.example.conf @@ -0,0 +1,27 @@ +-- SPDX-FileCopyrightText: 2025 LNRS +-- +-- SPDX-License-Identifier: AGPL-3.0-or-later +-- SPDX-License-Identifier: EUPL-1.2 + +-- Config file for kycheck ( +-- Uses Dhall syntax (https://dhall-lang.org) + +-- Verbosity levels +let Verbosity = < Test | Silent | Info | Errors | Debug > + +in { verbosity = Verbosity.Info + , ssl_location = "test/data/target_6.xml" + , threshold_ratio = 0.8 -- Percentage + , threshold_points = 200 -- Points needed to flag entry as match + , threshold_confidence = 0.67 -- Minimum confidence needed to pass + , perfect_points = 300 -- Amount of points required to get 100% confidence + + --> A higher weight will increase the number of matches + + , weight_address = 150 -- Residential address for humans or + -- Registered office address for legal entities + , weight_date = 100 -- Birth date of the subject + , weight_id = 200 -- Passport, ID card, drives license and other type of legal documents + , weight_name = 125 -- Given name and last name of the subject + , weight_nationality = 50 -- Country + } diff --git a/src/KYCheck/Config.hs b/src/KYCheck/Config.hs @@ -157,6 +157,11 @@ verbosityParser = verbositySilent <|> verbosityInfo <|> verbosityErrors <|> verb commandLine :: Parser CommandLine commandLine = CommandLine <$> optional verbosityParser + <*> strOption + ( long "config" + <> metavar "FILENAME" + <> help "Location of config file" + <> value "kycheck.conf" ) <*> optional ( strOption ( long "input" <> metavar "FILENAME" diff --git a/src/KYCheck/Type.hs b/src/KYCheck/Type.hs @@ -94,6 +94,7 @@ instance FromDhall Verbosity -- | Data type for user configuration via commandline data CommandLine = CommandLine { cl_verbosity :: Maybe Verbosity + , cl_config_location :: FilePath , cl_ssl_location :: Maybe FilePath , cl_threshold_ratio :: Maybe Float , cl_threshold_points :: Maybe Float