Giter Club home page Giter Club logo

config's People

Contributors

dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar g105b avatar peter279k avatar

Watchers

 avatar  avatar  avatar

config's Issues

Set separator character

Following on from #3, namespace separator character should be settable.

$config->setSeparator("-");
...
$user = getenv("something-database-user");
$config->setSeparator("/");
...
$user = getenv("something/database/user");

Although using slashes in an environment variable might be a bit mad.

Immutable merge

This is a backwards breaking change, so will require implementation in two steps:

  1. Introduce withMerge function, leaving merge as a mutable function, but start to emit a deprecation notice.
  2. Upon next major release, remove merge function completely.

It might actually make more sense to make merge immutable by default, but due to this decision being made, withMerge is so much more obvious what it does due to the consistency with other with functions.

Default behaviour: load config.ini

By default, this package should look for a config.ini in the project's root directory and load the contents into environment variables.

There are things to consider for this though:

  • Where is the project's root directory?
  • Is it always going to be document root?
  • No - that's probably the www directory.
  • So, should this package look up the directory tree from the doc root until it finds a config.ini?
  • Can getcwd() be used? Maybe PHP.Gt webengine could set the working directory to the project root, and so could other projects... so the expected behaviour is to load only from the cwd?

Can we generate multiple config values at once?

Idea (might already work like this, but needs documenting):

run: ./vendor/bin/config-generate deploy stripe.pub="${{ secrets.stripe_pub }}" stripe.private="${{ secrets.stripe_private }}"`

Self configuration

Try to avoid inception by configuring this package with a config.ini. An OO methodology is best for configuring the behaviour of where to read configuration.

Nested variables in ini files separated (like namespaces)

Following on from #3, something within a named section of an ini file should have that name optionally added to the environment variable.

[database]
host = localhost
user = root
$user = getenv("database_user");
// or, with a namespace set:
$user = getenv("something_database_user");

Namespace environment variables

Optionally set a "namespace" for all environment variables to exist within.

With the ini line name = Berty, setting the namespace with $config->setNamespace("something"); should allow this: $name = getenv("something_name").

Writer class

Write key-value-pairs to ini file by name. This will be used in deployment strategies to place the config.production.ini files in place.

FileFinder

Separate the responsibility of finding of config files into a new class.

Dot notation

[app]
namespace = Example
production.compile = true
production.minify = false

To access the namespace config value, $config->get("app.namespace");

Need to check that dot notation works fine: $config->get("app.production.compile");

Parser class

Separate parsing out into separate class, for simplicity and readability.

ConfigSection::asArray

I've come to a point in WebEngine v4 where an array of key value pairs needs to be passed into a function, and all I have access to is the Config object. Rather than building my own array, it'd be useful to get a pre-populated associative array from the class.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.