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 {
constructor(service) {
this.basePath = path.resolve(service.root, service.path);
this.service = service;
this.argv = [];
this.comments = [];
Object.defineProperty(this, '_service', {
get() {
return service;
}
});
}
fileName(filename) {
@ -89,31 +87,31 @@ class FoxxContext {
}
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() {
return this._service.collectionPrefix;
return this.service.collectionPrefix;
}
get mount() {
return this._service.mount;
return this.service.mount;
}
get name() {
return this._service.name;
return this.service.name;
}
get version() {
return this._service.version;
return this.service.version;
}
get manifest() {
return this._service.manifest;
return this.service.manifest;
}
get isDevelopment() {
return this._service.isDevelopment;
return this.service.isDevelopment;
}
get isProduction() {
@ -121,15 +119,15 @@ class FoxxContext {
}
get options() {
return this._service.options;
return this.service.options;
}
get configuration() {
return this._service.configuration;
return this.service.configuration;
}
get dependencies() {
return this._service.dependencies;
return this.service.dependencies;
}
}