phpgt / phpgt/Config

Only dev *or* prod config, not both

Open
#225 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
PHP
Stars
0
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Sometimes it's useful for the code to know whether we're in dev or prod mode. Currently, there is no way to know which mode we're in.

On the development environment, there can be an optional config.dev.ini that will override the default values in the config.ini. The expectation is that the dev ini does not get checked into version control, as this is where the actual keys and secret values will lie.

However, on dev it might be that you use "mock" versions of API keys, or have specific low-exposure keys generated for each developer. When the code gets to production, it would (and should) always be an error if the dev ini was found on the production server.


Proposed changes:

  1. throw an exception if there are both dev and prod at the same time.
  2. assume "prod" by default (for code reasons), so things like $config->getDeployment() will return the appropriate enum, and only assume "dev" if there is a config.dev.ini. This will mean that assuming prod by default can apply more strict security / not bundle source maps / etc.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Trace how config.ini and the optional config.dev.ini are loaded, then find the getDeployment() entry point. Confirm the intended behavior: production by default, development only when config.dev.ini exists, and an exception when both production and development configuration are present.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.