1
0
Fork 0

Expose module.context.service

This commit is contained in:
Alan Plum 2015-12-15 18:37:25 +01:00
parent 4140c26d30
commit 54f27f51a2
No known key found for this signature in database
GPG Key ID: 8ED72A9A323B6EFD
1 changed files with 13 additions and 15 deletions

View File

@ -45,12 +45,10 @@ const DEV_APP_PATH = internal.devAppPath ? path.resolve(internal.devAppPath) : u
class FoxxContext { class FoxxContext {
constructor(service) { constructor(service) {
this.basePath = path.resolve(service.root, service.path); this.basePath = path.resolve(service.root, service.path);
this.service = service;
this.argv = [];
this.comments = []; this.comments = [];
Object.defineProperty(this, '_service', {
get() {
return service;
}
});
} }
fileName(filename) { fileName(filename) {
@ -89,31 +87,31 @@ class FoxxContext {
} }
get baseUrl() { get baseUrl() {
return `/_db/${encodeURIComponent(internal.db._name())}/${this._service.mount.slice(1)}`; return `/_db/${encodeURIComponent(internal.db._name())}/${this.service.mount.slice(1)}`;
} }
get collectionPrefix() { get collectionPrefix() {
return this._service.collectionPrefix; return this.service.collectionPrefix;
} }
get mount() { get mount() {
return this._service.mount; return this.service.mount;
} }
get name() { get name() {
return this._service.name; return this.service.name;
} }
get version() { get version() {
return this._service.version; return this.service.version;
} }
get manifest() { get manifest() {
return this._service.manifest; return this.service.manifest;
} }
get isDevelopment() { get isDevelopment() {
return this._service.isDevelopment; return this.service.isDevelopment;
} }
get isProduction() { get isProduction() {
@ -121,15 +119,15 @@ class FoxxContext {
} }
get options() { get options() {
return this._service.options; return this.service.options;
} }
get configuration() { get configuration() {
return this._service.configuration; return this.service.configuration;
} }
get dependencies() { get dependencies() {
return this._service.dependencies; return this.service.dependencies;
} }
} }