mdshack / shotshare

Open source image sharing application
https://demo.shotshare.dev/
MIT License
137 stars 10 forks source link

[Enhancement] Store config in a configuration file instead of relying on environment variables #43

Closed EmberHeartshine closed 2 months ago

EmberHeartshine commented 9 months ago

Title. I'm trying to hack together a bare metal install (instead of using docker) and while I totally can define environment variables at runtime (or in my php.ini file, or through nginx directives), I'd really rather not mess with root-owned files as much as possible. For Docker installs, it would more or less replace the .env file with some PHP variable definitions in a file named, say, config.php. I would personally model it after Nextcloud's configuration:

<?php
     $CONFIG = array (
          'HOST' => ':80`,
          'REQUIRE_HTTPS' => 'true',
     );

and so on. If you really want to keep using environment variables, the default config could probably look like this:

<?php
     $CONFIG = array (
          'HOST' => getenv( 'HOST' ),
          'REQUIRE_HTTPS' => getenv( 'REQUIRE_HTTPS' ),
     );

and so on.

mdshack commented 8 months ago

Hey @EmberHeartshine, circling back here. I am not sure I see a huge value here, Docker should allow you to natively do an env file, if you don’t want to use compose or inline env cars. Let me know if I am missing something here.

EmberHeartshine commented 8 months ago

This is for installs not using Docker.

mdshack commented 2 months ago

Going to go ahead and close this one - since the application itself relies environment variables there are a number of ways to set these for the PHP environment (outside of .env) that could vary from runtime to runtime, thus I think the primary supported method of deployment will by Docker for now, and other installation methods should be community supported (keeping the maintenance burden lower for myself/any other contributors).