byrokrat / giroapp

Command line app for managing autogiro donations.
GNU General Public License v3.0
4 stars 2 forks source link

Keep settings outside of the database #160

Closed hanneskod closed 6 years ago

hanneskod commented 6 years ago

To be able to support different database engines we need to bootstrap from settings outside of the db.

A simple ini file should do it. No need for fancy data..

What will happen whit the init command?

hanneskod commented 6 years ago

This potentially opens a lot of possibilities:

Implementation ideas:

class ConfigManager
{
    Function loadFile(ConfigFile $configFile): void;

    Function getConfig(string $name): ConfigInterface;
}

Class Config
{
    Function getValue(): string;
}

If Config is a promise like this values can be loaded in container (first defaults and then specifics if file exists) and overwritten in command (if specified on command line) and then read throughout the application when needed..

ConfigFile as a simple parse_ini_string() wrapper.

hanneskod commented 6 years ago

150