-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathModuleConfig.cfc
57 lines (49 loc) · 1.87 KB
/
ModuleConfig.cfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
component {
this.title = "Mandrill";
this.author = "Joseph Lamoree";
this.webURL = "https://github.com/ecivis/mandrill";
this.description = "An interface to the Mandrill API.";
this.version = "0.0.4";
this.dependencies = [];
this.autoMapModels = false;
this.cfmapping = "mandrill";
/**
* Configure
*/
public void function configure() {
variables.settings = {
"apiKey": "", // A valid Mandrill API key is required to use the service.
"endpointBaseUrl": "" // This is optional. The connector will use its default if not overridden.
};
}
/**
* Fired when the module is registered and activated.
*/
public void function onLoad() {
// Backwards compatiblity with ColdBox 4.2
if (variables.settings.apiKey == "") {
if (variables.controller.settingExists("mandrill")) {
if (variables.controller.getSetting("mandrill").keyExists("apiKey")) {
variables.settings.apiKey = variables.controller.getSetting("mandrill").apiKey;
}
}
}
variables.binder.map("mandrillConnector@mandrill")
.to("mandrill.models.MandrillConnector")
.initArg(name="apiKey", value=variables.settings.apiKey)
.initArg(name="endpointBaseUrl", value=variables.settings.endpointBaseUrl)
.asSingleton();
variables.binder.map("mandrillClient@mandrill")
.to("mandrill.models.Mandrill")
.withInfluence(function (injector, object, instance) {
instance.setMandrillConnector(injector.getInstance("mandrillConnector@mandrill"));
return instance;
})
.asSingleton();
}
/**
* Fired when the module is unregistered and unloaded
*/
public void function onUnload() {
}
}