frankenphp icon indicating copy to clipboard operation
frankenphp copied to clipboard

Add a directive for loading `ini`files

Open jakubtobiasz opened this issue 1 year ago • 2 comments

Describe you feature request

Is your feature request related to a problem? Please describe. I have the following configuration:

{
	frankenphp
	order php_server before file_server
	log {
        level DEBUG
    }
}

:443 {
	tls /cert/_wildcard.orb.local.pem /cert/_wildcard.orb.local-key.pem

	root * {$PUBLIC_DIR:/app/public}

	@has_xdebug_cookie header Cookie *XDEBUG_SESSION*

	route @has_xdebug_cookie {
		php_server {
			env XDEBUG_MODE "debug" <---- it doesn't work here :(
		}
	}

	route {
		php_server 
	}
}

To improve performance while developing an app, I'd like to provide a conditional xdebug enabling. I've noticed the XDebug Helper sets the XDEBUG_SESSION cookie. So, I know when I should do something (enable XDebug). However, I've noticed the only way to provide an additional .ini file is by setting an environment variable, which is not possible for me. I'm not sure if it is possible, but it would be great if I could provide an extra .ini file as a directive instead of an environment variable.

Describe the solution you'd like Something like:

...
	route @has_xdebug_cookie {
		php_server {
			ini "some_path_to_my.ini"
		}
	}
...

Describe alternatives you've considered n/a

jakubtobiasz avatar Dec 07 '24 19:12 jakubtobiasz

Good idea. We could even support setting INI directives directly in the Caddyfile.

dunglas avatar Dec 07 '24 19:12 dunglas

Great to hear! 🥳 I can't wait to see the PR, as I was looking into the source of Franken, but it's magic for me (yet) ✨.

jakubtobiasz avatar Dec 08 '24 08:12 jakubtobiasz