Added support for configuration files

This commit is contained in:
2020-11-21 10:21:39 +01:00
parent f1648dade6
commit 76d8f5f147
5 changed files with 51 additions and 12 deletions

View File

@@ -119,7 +119,7 @@ sub new {
$self->{'cursor'} = Gtk2::Gdk::Cursor->new('left-ptr');
$self->{'rootwin'} = Gtk2::Gdk->get_default_root_window();
# split window to add menu, toolbar and notebook
# split window horizontal to add menu, toolbar and notebook
$self->{'mvb'} = Gtk2::VBox->new();
$self->{'mw'}->add($self->{'mvb'});

View File

@@ -21,11 +21,38 @@ use strict;
package HELPERS;
use POSIX;
use Config::Tiny;
my $version = "0.1";
my $true = 1;
my $false = undef;
#
# read global configuration file
#
sub read_global_cfg {
my $cfg = Config::Tiny->read("/etc/tinyca/tinyca.cnf", 'utf8');
return ($cfg);
}
#
# read a per CA configuration
#
sub read_cfg {
my $base = shift;
my $cfg = Config::Tiny->read($base."/tinyca.cnf", 'utf8');
return ($cfg);
}
#
# read per user configuration
# e.g. last used ca, last window position
#
sub read_user_cfg {
my $cfg = Config::Tiny->read($ENV{HOME}."/.tinycarc", 'utf8');
return ($cfg);
}
#
# generate filename from Subject-DN
#