Ticket #42 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

Create a way to access all conf.yaml settings from anywhere without any defines

Reported by: ociule Owned by: ociule
Priority: normal Milestone: 0.5
Component: architecture Version:
Severity: major Keywords:
Cc:

Description (last modified by ociule) (diff)

UPDATE: just use global $conf, this works from anywhere and does exactly that.

Right now, it one wants to change a setting between environments, he can add it to conf.yaml and then add a define in conf.php, like this:

conf.yaml:
==========
env:
    dev:
        default_admin_address: dev_admin@example.com


conf.php:
==========
define('DEFAULT_ADMIN_ADDRESS', $conf['default_admin_address'])

This is cumbersome and repetitive.

A service would be nice so that we could do:

$turb->env->default_admin_address

from anywhere, and without the stupid define.

Furthermore, this would finally allow using arrays (or any composite type for that matter) defined in conf.yaml. Right now, this is really ugly to do, as PHP does not allow array in constants (you cannot put an array into a constant).

Change History

comment:1 Changed 3 years ago by ociule

  • Description modified (diff)

comment:2 Changed 3 years ago by ociule

  • Description modified (diff)

comment:3 Changed 3 years ago by ociule

(In [512]) Added a new Env service. Some doc. See #42

comment:4 Changed 3 years ago by ociule

(In [513]) Register the new Env module. See #42

comment:5 Changed 3 years ago by ociule

  • Description modified (diff)

comment:6 Changed 3 years ago by ociule

(In [514]) Use the new Env service from the ExceptionNotifier?. No more ugly static atributes. See #42

comment:7 Changed 3 years ago by ociule

(In [516]) Phasing out the Env service - just use global $conf. See #42

comment:8 Changed 3 years ago by ociule

Don't listen to me, I'm stupid, just use global $conf.

comment:9 Changed 3 years ago by ociule

  • Description modified (diff)

comment:10 Changed 3 years ago by ociule

  • Status changed from new to closed
  • Resolution set to fixed

comment:11 Changed 3 years ago by ociule

(In [517]) Removed the Env service - just use global $conf. See #42

Note: See TracTickets for help on using tickets.