Idephix icon indicating copy to clipboard operation
Idephix copied to clipboard

global settings

Open micheleorselli opened this issue 9 years ago • 2 comments

There are few settings which could be tweaked via conf like:

  • default timeout for commands: now you have to specify it in every local invocation
  • failonerror: the default behaviour is to stop when something goes wrong, maybe there are some use cases where the script should continue

makes sense? I'm for creating a single array with all the needed configuration

micheleorselli avatar Aug 18 '16 11:08 micheleorselli

So our idxrc would be like


<?php

return \Idephix\Config::fromArray(
    array(
        \Idephix\Config::ENVS => $environments
        \Idephix\Config::TIMEOUT => 60,
        \Idephix\Config::FAILONERROR => true,
    )
);

We should continue to add constants for "reserved" configuration keys, shouldn't we? And of course we will have defaults for those extra values.

ftassi avatar Aug 18 '16 14:08 ftassi

sort of, as an alternative way we could put it in a global array like that

$config = [
    'envs' => [
        'prod' => [...],
        'dev' => []
    ],
    'command_timeout' => 500,
    'fail_on_error' => false  
]

return \Idephix\Config::fromArray($config)

the main benefit I see in this approach is hiding Config class internals plus enforcing config keys validation

micheleorselli avatar Aug 18 '16 14:08 micheleorselli