Accept a config filename as an optional parameter to Ghost start-up.#1110
Accept a config filename as an optional parameter to Ghost start-up.#1110rektide wants to merge 1 commit intoTryGhost:masterfrom
Conversation
|
Would it also use a different content directory? |
|
The database can be specified in the config file (overriding the default Good call. Switching databases was my first use case, but changing themes/style per-deploy a need too. This patch is clean and has minimal touch points: I'd very much like to see it merged, and serve as a basis for ongoing changes and discussion such as @bastilian's comments (which will require more sweeping changes). Please promote this, which will help me get started carrying these ideas along. |
|
This is a good idea 👍 and it would be nice to see a PR for the second part (making it possible to configure the content directories) as well at some point. Happy to get this merged in if you could please resolve the issues raised in my comments. |
|
@rektide - Any chance you can look into updating this? |
|
Via an environmental var would also be useful and consistent with NODE_ENV |
|
I'm not sure if this is intended for merge now as there is no comment, but please take a minute to read our guide on submitting PRs https://github.com/TryGhost/Ghost/blob/master/CONTRIBUTING.md#submitting-pull-requests particularly the part on cleaning-up history, thanks :) |
Closes TryGhost#1110. - Promotes config-loader from a validator, to the central place where configuration state is held - Allow config-loader two means to be told of config file to be used: - A preferred first argument passed into Ghost - A secondary GHOST_CONFIG environmental variable - Failing to see either of the above passed in, config-loader will continue to use "config.js" - Config-loader validates the target configuration (unchanged) & then copies that object into it's own exports - Components needing to read configuration now require config-loader to retrieve the configuration state - Config file continues to be loaded via require(), allowing program code to generate & export configuration, as well as simple JSON
Closes TryGhost#1110. - Promotes config-loader from a validator, to the central place where configuration state is held - Allow config-loader two means to be told of config file to be used: - A preferred first argument passed into Ghost - A secondary GHOST_CONFIG environmental variable - Failing to see either of the above passed in, config-loader will continue to use "config.js" - Config-loader validates the target configuration (unchanged) & then copies that object into it's own exports - Components needing to read configuration now require config-loader to retrieve the configuration state - Config file continues to be loaded via require(): this is assumed to be a static json file
|
Hi, I just noticed there is a newer commit on this. Is it ready for merge? I don't get a notification for updates to a PR unless you comment so I wasn't aware any work had been done sorry 😦 |
|
Rebased and merged |
This feature pull-request permits a single argument to be passed into Ghost: a config filename to use, which will override the default ${appRoot}/config.js if specified.
This feature permits a single instance of Ghost to exist that any number of individual software users can use. Without this, any Ghost user needs a full checkout. For example, with this feature a sysadmin could install /opt/ghost read-only, and I could run
node /opt/ghost/index /home/rektide/.config/ghost/config.jswhile my admin also startsnode /opt/ghost/index /srv/ghost/config.js. Enabling this division between the software-package and a service's specific data is faithful to the Filesystem Hierarchy specs's division between /opt and /srv;http://www.pathname.com/fhs/pub/fhs-2.3.html#OPTADDONAPPLICATIONSOFTWAREPACKAGES
http://www.pathname.com/fhs/pub/fhs-2.3.html#SRVDATAFORSERVICESPROVIDEDBYSYSTEM
Briefly on implementation, this pull-request enhances config-loader's current role as a validation pass, promoting it's own exports with the values it validates. The remainder of Ghost points to the config-loader instead of having a hardcoded path to the config file.
Thank you. Please let me know if there's anything I can do to help facilitate this patch.