Skip to content
This repository has been archived by the owner on Jul 9, 2018. It is now read-only.
/ asset-mongo Public archive

Mongo/GridFS backend for the travetto asset module

Notifications You must be signed in to change notification settings

travetto/asset-mongo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

travetto: Asset-Mongo

This provides a mongodb implementation of the AssetSource that which is a backend for the Asset module.

The primary utilization of this module, is to configure the AssetSource injectable, and provide whatever configuration you would like to use.

class AppConfig {
  @InjectableFactory()
  static getConf(): AssetMongoConfig {
    return new AssetMongoConfig();
  }
  @InjectableFactory()
  static getSource(cfg: AssetMongoConfig): AssetSource {
    return new AssetMongoSource(cfg);
  }
}

As seen, there is a default configuration that you can easily use, with some sensible defaults.

The default configuration class looks like:

@Config('asset.mongo')
export class AssetMongoConfig {
  hosts = 'localhost';
  schema = 'app';
  port = 27017;
  options = {};
  ...
}

Additionally, you can see that the class is registered with the @Config annotation, and so these values can be overridden using the standardConfiguration resolution paths.