diff --git a/spec/CloudCode.spec.js b/spec/CloudCode.spec.js index a2e623551a..90ab313826 100644 --- a/spec/CloudCode.spec.js +++ b/spec/CloudCode.spec.js @@ -103,6 +103,14 @@ describe('Cloud Code', () => { expect(currentConfig.silent).toBeFalse(); }); + it('can get curent version', () => { + const version = require('../package.json').version; + const currentConfig = Config.get('test'); + expect(Parse.Server.version).toBeDefined(); + expect(currentConfig.version).toBeDefined(); + expect(Parse.Server.version).toEqual(version); + }); + it('show warning on duplicate cloud functions', done => { const logger = require('../lib/logger').logger; spyOn(logger, 'warn').and.callFake(() => {}); diff --git a/src/Config.js b/src/Config.js index 8fe10a9a1c..0e8cdda246 100644 --- a/src/Config.js +++ b/src/Config.js @@ -7,6 +7,7 @@ import net from 'net'; import AppCache from './cache'; import DatabaseController from './Controllers/DatabaseController'; import { logLevels as validLogLevels } from './Controllers/LoggerController'; +import { version } from '../package.json'; import { AccountLockoutOptions, DatabaseOptions, @@ -50,6 +51,7 @@ export class Config { config.generateEmailVerifyTokenExpiresAt = config.generateEmailVerifyTokenExpiresAt.bind( config ); + config.version = version; return config; }