-
Notifications
You must be signed in to change notification settings - Fork 0
/
Application.cfc
65 lines (56 loc) · 2.04 KB
/
Application.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
58
59
60
61
62
63
64
65
component {
this.name="cfml_notion_sdk";
this.clientmanagement="true";
this.sessionmanagement="true";
this.setclientcookies="true";
this.setdomaincookies="false";
this.sessiontimeout=createTimeSpan(0,2,0,0);
this.applicationtimeout=createTimeSpan(1,0,0,0);
this.loginstorage="session";
this.mappings["/lib"] = getDirectoryFromPath(getCurrentTemplatePath()) & "lib";
this.mappings["/models"] = getDirectoryFromPath(getCurrentTemplatePath()) & "lib/src/models";
/*
this.datasource = "db_notion";
this.ormEnabled = true;
this.ormsettings = {cfclocation = this.mappings["/models"],
eventhandling = true,
flushatrequestend = false,
//secondarycacheenabled = true, Cacheprovider = "EHCache",
logsql="false"};
*/
this.triggerDataMember=true;
this.invokeImplicitAccessor=true;
function onApplicationStart()
{
// Default Notion settings
Application.notion = {
notionVersion: "2022-06-28",
baseUrl: "https://api.notion.com/v1"
}
}
function onRequestStart()
{
// If settings.json file exists, read Notion settings from file.
try{
var settings = deserializeJson(fileRead('./config/settings.json'));
if (!isNull(settings)){
for (var key in settings){
Application.notion[key] = settings[key];
}
}
}catch (any e){
if (!findnocase('does not exist', e.Message)){
writeOutput("<div style='background-color:red; color: white; width:90%; padding:10px; top:0px; left:0px;'>settings.json file exists but contains errors. Default settings to be used. <BR/><BR/>#e.Message#<BR/></div>");
}
}
// If databases.json file exists, read Notion settings from file.
try{
var databases = deserializeJson(fileRead('./config/databases.json'));
Application.notion["databases"] = databases;
}catch (any e){
if (!findnocase('does not exist', e.Message)){
writeOutput("<div style='background-color:red; color: white; width:90%; padding:10px; top:0px; left:0px;'>databases.json file exists but contains errors. Default settings to be used. <BR/><BR/>#e.Message#<BR/></div>");
}
}
}
}