diff --git a/Gruntfile.js b/Gruntfile.js index 8409840709..396093dd15 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -6,7 +6,6 @@ // // **Debug tip:** If you have any problems with any Grunt tasks, try running them with the `--verbose` command const config = require('./core/shared/config'); -const urlService = require('./core/frontend/services/url'); const _ = require('lodash'); const fs = require('fs-extra'); const KnexMigrator = require('knex-migrator'); @@ -333,7 +332,7 @@ const configureGrunt = function (grunt) { watch: { projects: { - 'core/client': ['shell:ember:watch', '--live-reload-base-url="' + urlService.utils.getSubdir() + '/ghost/"'] + 'core/client': ['shell:ember:watch', '--live-reload-base-url="' + config.getSubdir() + '/ghost/"'] } } }, diff --git a/core/shared/config/loader.js b/core/shared/config/loader.js index a0f420b9c8..8c2c4c43bd 100644 --- a/core/shared/config/loader.js +++ b/core/shared/config/loader.js @@ -6,8 +6,13 @@ const _debug = require('@tryghost/debug')._base; const debug = _debug('ghost:config'); const localUtils = require('./utils'); const helpers = require('./helpers'); +const urlHelpers = require('@tryghost/config-url-helpers'); const env = process.env.NODE_ENV || 'development'; +/** + * @param {object} options + * @returns {Nconf.Provider & urlHelpers.BoundHelpers} + */ function loadNconf(options) { debug('config start'); options = options || {}; @@ -47,6 +52,7 @@ function loadNconf(options) { // Expose dynamic utility methods nconf.isPrivacyDisabled = helpers.isPrivacyDisabled.bind(nconf); nconf.getContentPath = helpers.getContentPath.bind(nconf); + urlHelpers.bindAll(nconf); // ## Sanitization diff --git a/package.json b/package.json index bfd7ee8f8a..324cbb24ff 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "@tryghost/admin-api-schema": "2.3.0", "@tryghost/bookshelf-plugins": "0.1.2", "@tryghost/bootstrap-socket": "0.2.9", + "@tryghost/config-url-helpers": "^0.1.0", "@tryghost/constants": "0.1.8", "@tryghost/debug": "0.1.1", "@tryghost/email-analytics-provider-mailgun": "1.0.0", diff --git a/yarn.lock b/yarn.lock index e472ebc404..8e86301bfd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -626,6 +626,11 @@ dependencies: long-timeout "^0.1.1" +"@tryghost/config-url-helpers@^0.1.0": + version "0.1.0" + resolved "https://registry.yarnpkg.com/@tryghost/config-url-helpers/-/config-url-helpers-0.1.0.tgz#10cb3930c19a72e4967b52c6d6450a05449a3f9d" + integrity sha512-zZU4+sKlK7L7wz7X7s6XEPrhWYJuMSaR65FaktZsdUQNneTHcmSQXJyLhWKLMFeayP51Os6tPYlLitBvHFLUOA== + "@tryghost/constants@0.1.8": version "0.1.8" resolved "https://registry.yarnpkg.com/@tryghost/constants/-/constants-0.1.8.tgz#b08074cdc6f8a379209750e60c2ab62c8ba895cf"