Skip to content

Commit

Permalink
Quick tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
timsayshey committed Aug 9, 2017
1 parent 6d1acca commit fbc7c85
Show file tree
Hide file tree
Showing 17 changed files with 170 additions and 147 deletions.
17 changes: 2 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,6 @@ cd wheelie
docker-compose -f config/docker/local-mysql/docker-compose.yml up
```

Then go to the Lucee admin and add the Mysql Datasource running in Docker:
http://localhost:8080/lucee/admin/web.cfm?action=services.datasource

```
DB Type: Mysql
Datasource name: wheelie
Host/Server: wheelie_mysql
Database: wheeliedb
Username: root
Password: NOT_SECURE_CHANGE
```

You will also need to add an SMTP server otherwise you're going to have a bad time:
http://localhost:8080/lucee/admin/web.cfm?action=services.mail

Then access the application via:
http://localhost:8080

Expand All @@ -44,6 +29,8 @@ Username: admin@getwheelie.com
Password: wheelie
```

Configure your app here: `config/docker/local-mysql/docker-compose.yml`

External MYSQL Connection Info:

```
Expand Down
2 changes: 1 addition & 1 deletion config/Routes.cfm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.<cfscript>
adminUrlPath = getSiteSetting("wheelsAdminUrlPath","/manager");
adminUrlPath = getSiteSetting("WHEELIE_ADMINURLPATH","/manager");
application.wheels.adminUrlPath = adminUrlPath;
// Custom routes
Expand Down
82 changes: 78 additions & 4 deletions config/app.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,85 @@
include template="/models/services/global/app/systemvars.cfm";
this.runtimeconfig = setRuntimeSettings();
include template="/models/services/global/settings.cfm";
this.applicationTimeout = "#createTimespan(30,0,0,0)#";
this.applicationTimeout = createTimespan(30,0,0,0);
this.sessionManagement = "true";
this.sessionTimeout = "#createTimeSpan(30,0,0,0)#";
this.sessionTimeout = createTimeSpan(30,0,0,0);
this.name = "Wheelie";
rootPath = getDirectoryFromPath(getBaseTemplatePath());
request.muraInDocker=len(getSiteSetting('WHEELIE_DATASOURCE')) && len(getSiteSetting('WHEELIE_DATABASE'));
if(request.muraInDocker){
this.tag.mail.server=getSiteSetting('WHEELIE_SMTP_SERVER');
this.tag.mail.username=getSiteSetting('WHEELIE_SMTP_USERNAME');
this.tag.mail.password=getSiteSetting('WHEELIE_SMTP_PASSWORD');
this.tag.mail.port=getSiteSetting('WHEELIE_SMTP_PORT');
this.tag.mail.usetls=getSiteSetting('WHEELIE_SMTP_USETLS');
if(server.coldfusion.productname == 'lucee'){
driverVarName='type';
switch(getSiteSetting('WHEELIE_DBTYPE')){
case 'mysql':
driverName='mysql';
break;
case 'mssql':
driverName='mssql';
break;
case 'oracle':
driverName='Oracle';
break;
case 'postgresql':
driverName='PostgreSQL';
break;
}
} else {
driverVarName='driver';
switch(getSiteSetting('WHEELIE_DBTYPE')){
case 'mysql':
driverName='MySQL5';
break;
case 'mssql':
driverName='MSSQLServer';
break;
case 'oracle':
driverName='Oracle';
break;
case 'postgresql':
driverName='PostgreSQL';
break;
}
}
this.datasources={
'#getSiteSetting('WHEELIE_DATASOURCE')#' = {
'#driverVarName#' = driverName
, host = getSiteSetting('WHEELIE_DBHOST')
, database = getSiteSetting('WHEELIE_DATABASE')
, port = getSiteSetting('WHEELIE_DBPORT')
, username = getSiteSetting('WHEELIE_DBUSERNAME')
, password = getSiteSetting('WHEELIE_DBPASSWORD')
},
nodatabase= {
'#driverVarName#' = driverName
, host = getSiteSetting('WHEELIE_DBHOST')
, database = ''
, port = getSiteSetting('WHEELIE_DBPORT')
, username = getSiteSetting('WHEELIE_DBUSERNAME')
, password = getSiteSetting('WHEELIE_DBPASSWORD')
}
};
this.webadminpassword=getSiteSetting('WHEELIE_ADMIN_PASSWORD');
}
// this.datasources["App"] = {
// class: 'org.gjt.mm.mysql.Driver'
// , connectionString: 'jdbc:mysql://wheelie_mysql:3306/wheeliedb?useUnicode=true&characterEncoding=UTF-8&useLegacyDatetimeCode=true'
// , username: 'root'
// , password: "encrypted:2c66b1dd756f915a7984fc9fef742676a9d3c4f6466ff26c3e907fe026a50a70cde804b61f8d1eaa87a69ec4a09f4eb2"
// // optional settings
// , connectionLimit:100 // default:-1
// };
</cfscript>
31 changes: 20 additions & 11 deletions config/docker/local-mysql/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,44 @@ services:
SSL_PORT: 8443
CFENGINE: lucee@5
CFCONFIG_ADMINPASSWORD: NOT_SECURE_CHANGE
WHEELIE_ADMIN_USERNAME: admin
WHEELIE_ADMIN_PASSWORD: admin
WHEELIE_ADMINEMAIL: example@localhost.com
WHEELIE_APPRELOADKEY: appreload
WHEELIE_APPRELOADPASS: woot
WHEELIE_DEFAULTEMAIL: default@getwheelie.com
WHEELIE_NOREPLYEMAIL: noreply@getwheelie.com
WHEELIE_ADMINEMAIL: admin@getwheelie.com
WHEELIE_ERROREMAILADDRESS: error@getwheelie.com
WHEELIE_ADMINFROMEMAIL: admin@getwheelie.com
WHEELIE_EMAILONERROR: "true"
WHEELIE_URLREWRITING: "on"
WHEELIE_REWRITEFILE: index.cfm
WHEELIE_PASSWORDSALT: OkIeKNKoIvbZMFPuMJ3EMQ==
WHEELIE_ADMINURLPATH: /manager
WHEELIE_DATASOURCE: wheelie
WHEELIE_DATABASE: wheeliedb
WHEELIE_DBTYPE: mysql
WHEELIE_DBUSERNAME: root
WHEELIE_DBPASSWORD: NOT_SECURE_CHANGE
WHEELIE_DBHOST: wheelie_mysql
WHEELIE_DBHOST: wheelie_mysql_db
WHEELIE_DBPORT: 3306
WHEELIE_SITEIDINURLS: "false"
WHEELIE_INDEXFILEINURLS: "true"
WHEELIE_TESTBOX: "true"
WHEELIE_SMTP_SERVER: smtp.sendgrid.net
WHEELIE_SMTP_USERNAME: yoursendgridusername
WHEELIE_SMTP_PASSWORD: sendgridpass
WHEELIE_SMTP_PORT: 587
WHEELIE_SMTP_USETLS: "true"
volumes:
- ../../../:/app
ports:
- "8080:8080"

#MySQL
wheelie_mysql:
wheelie_mysql_db:
image: mysql:latest
environment:
MYSQL_ROOT_PASSWORD: NOT_SECURE_CHANGE
MYSQL_DATABASE: wheeliedb
volumes:
- wheelie_mysql_data:/var/lib/mysql
- wheelie_mysql_db_data:/var/lib/mysql
ports:
- "55555:3306"

volumes:
wheelie_mysql_data:
wheelie_mysql_db_data:
14 changes: 0 additions & 14 deletions config/system.properties
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
passwordSalt=OkIeKNKoIvbZMFPuMJ3EMQ==

s3Enabled=false
s3accessKeyId=
s3awsSecretKey=
s3defaultLocation=us
s3host=s3.amazonaws.com
s3defaultBucket=

wheelsDatasourceName=wheelie
wheelsReloadPassword=wheelie
wheelsUrlRewriting=On
wheelsRewriteFile=index.cfm
wheelsSendEmailOnError=true
wheelsAdminUrlPath=/manager

noReplyEmail=noreply@wheelie.com
defaultEmail=admin@wheelie.com

youtubeDevKey=
stripeKey=
sendgridusername=
sendgridpassword=
9 changes: 0 additions & 9 deletions events/functions.cfm
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
<cfoutput>
<cfscript>
request.fieldslist = "";
include "/models/services/global/functions.cfm";
setSiteInfo();
settingsFilePath = "/views/themes/#request.site.theme#/settings.cfm";
if(fileExists(expandPath(settingsFilePath)))
{
include "#settingsFilePath#";
}
</cfscript>

<cffunction name="getFieldVal">
Expand Down
22 changes: 22 additions & 0 deletions events/onapplicationstart.cfm
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
<cfscript>
include template="/views/setup/check.cfm";
// Initialize Shortcode plugins
include template="/models/services/global/settings.cfm";
setSiteInfo();
// Set User Permissions
if ( isNull(application.rbs.permissionsQuery) || isReload ) {
var q = new query( datasource="wheelie" );
q.addParam( name="lastModifiedTime", cfsqltype="cf_sql_timestamp", value=now());
application.rbs.permissionsQuery = q.execute( sql="SELECT * FROM permissions" ).getResult();
// Get role columns from permissions table - removed non role columns - convert array to remove list nulls - convert back to list
application.rbs.roleslist = ArrayToList(ListToArray(ReplaceList(lcase(application.rbs.permissionsQuery.columnList),lcase("CREATEDBY,UPDATEDBY,UPDATEDAT,CREATEDAT,DELETEDAT,DELETEDBY"),"")));
application.rbs.roleslist = replaceNoCase(application.rbs.roleslist, "ID,", "");
for (var thisRole in listToArray(application.rbs.roleslist) ) {
for (var row in application.rbs.permissionsQuery ) {
application.rbs.permission[row.id][thisRole] = application.rbs.permissionsQuery[thisRole];
}
}
}
application.shortcodes={};
include template="/views/plugins/plugins-init.cfm";
</cfscript>
16 changes: 11 additions & 5 deletions events/onerror.cfm
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<cfheader statuscode="500" statustext="Internal Server Error">
<cfheader name="cache-control" value="no-cache, no-store, must-revalidate">
<cfheader statuscode="301" statustext="Moved permanently">
<cfheader name="Location" value="/o/500">
<cfabort>
<cfif cgi.path_info == '/o/500'>
<!--- Prevent redirect loop --->
500 Error
<cfdump var="#exception#" abort>
<cfelse>
<cfheader statuscode="500" statustext="Internal Server Error">
<cfheader name="cache-control" value="no-cache, no-store, must-revalidate">
<cfheader statuscode="301" statustext="Moved permanently">
<cfheader name="Location" value="/o/500">
<cfabort>
</cfif>
11 changes: 7 additions & 4 deletions events/onrequeststart.cfm
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
<cfscript>
include template="/views/setup/check.cfm";
setSiteInfo();
include "/models/services/global/settings.cfm";
settingsFilePath = "/views/themes/#request.site.theme#/settings.cfm";
if(fileExists(expandPath(settingsFilePath))) {
include "#settingsFilePath#";
}
thisSiteUrl = "http://#request.site.domain#";
if(
isNull(session.referer) AND len(trim(cgi.http_referer)) AND
(len(cgi.http_referer) GTE thisSiteUrl AND Left(cgi.http_referer,len(thisSiteUrl)) NEQ thisSiteUrl OR len(cgi.http_referer) LT thisSiteUrl)
)
{
) {
session.referer = cgi.http_referer;
}
Expand Down Expand Up @@ -42,5 +47,3 @@
<cfcookie name="cftoken" domain="#request.site.domain#" value="#session.cftoken#"> --->

<cfset application.wheels.errorEmailAddress=application.wheels.adminFromEmail>


2 changes: 1 addition & 1 deletion models/services/global/app/app.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<cfscript>
// Override pretty much any application setting here
// Override admin scope set in /models/services/global/init/setinfo.cfm
infoAppend.adminUrlPath = getSiteSetting("wheelsAdminUrlPath","/manager");
infoAppend.adminUrlPath = getSiteSetting("WHEELIE_ADMINURLPATH","/manager");
infoAppend.itemThumbPath = "/assets/uploads/items/";
infoAppend.propertyThumbPath = "/assets/uploads/mediafiles/";
infoAppend.fileItemThumbs = fixFilePathSlashes("#fileroot##infoAppend.itemThumbPath#");
Expand Down
61 changes: 2 additions & 59 deletions models/services/global/global.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,10 @@
!isNull(url.password) and
!isNull(application.wheels.reloadPassword) and
url.password eq application.wheels.reloadPassword
)
{
) {
isReload = true;
}
// if (!structKeyExists(application, 'markdown') or isReload) {
// // Directory containing all the necessary jar files.
// jarDir = expandPath("/models/services/vendor/cfmarkdown");
// // Array of necessary classes
// jClass = [
// "#jarDir#/parboiled-java-1.1.3.jar"
// ,"#jarDir#/asm-all-4.1.jar"
// ,"#jarDir#/parboiled-core-1.1.3.jar"
// ,"#jarDir#/pegdown-1.2.1.jar"
// ];
// javaloader = createObject('component','models.services.vendor.javaloader.JavaLoader').init(jClass, false);
// // Hex values for different extensions can be found in org.pegdown.Extensions.java (0x20 is for tables support)
// // Output the HTML conversion --->
// //<cfoutput>#variables.pegdown.markdownToHtml(markdownString)#</cfoutput>
// application.markdown = javaloader.create("org.pegdown.PegDownProcessor").init(javaCast("int", InputBaseN("0x20", 16)));;
// }
// markdown = application.markdown;
// Setup Underscore.cfc
if (!structKeyExists(application, '_') or isReload) {
application._ = CreateObject("component","models.services.vendor.underscore").init();
Expand All @@ -56,51 +33,17 @@
application.validateit = CreateObject("component","models.services.vendor.validateit").init();
}
/* Setup VideoConverter
if (!structKeyExists(application, 'videoConverter') or isReload) {
videoFileMgr = CreateObject("component","models.services.vendor.videoconverter.FileMgr").init(info.fileuploads,info.uploadsPath);
application.videoConverter = CreateObject("component","models.services.vendor.videoconverter.VideoConverter").init(videoFileMgr);
}*/
// Setup filemanager
application.fileMgr = CreateObject("component","models.services.vendor.filemgr").init(info.fileuploads,info.uploadsPath);
// Setup private filemanager
// if (!structKeyExists(application, 'privatefileMgr') or isReload) {
// application.privateFileMgr = CreateObject("component","models.services.vendor.filemgr").init(info.privateroot,info.privateRootPath);
// }
// Setup pagination
application.pagination = CreateObject("component","models.services.vendor.pagination").init();
//writeDump(application.pagination); abort;
// Make them accessible from local scope
include "/models/services/global/init/setservices.cfm";
</cfscript>

<!--- Set User Permissions --->
<cfif isNull(application.rbs.permissionsQuery) or isReload>
<cfscript>
q = new query( datasource="wheelie" );
q.addParam( name="lastModifiedTime", cfsqltype="cf_sql_timestamp", value=now());
application.rbs.permissionsQuery = q.execute( sql="SELECT * FROM permissions" ).getResult();
</cfscript>

<!--- Get role columns from permissions table - removed non role columns - convert array to remove list nulls - convert back to list --->
<cfset application.rbs.roleslist = ArrayToList(ListToArray(ReplaceList(lcase(application.rbs.permissionsQuery.columnList),lcase("CREATEDBY,UPDATEDBY,UPDATEDAT,CREATEDAT,DELETEDAT,DELETEDBY"),"")))>
<cfset application.rbs.roleslist = replaceNoCase(application.rbs.roleslist, "ID,", "")>
<cfloop list="#application.rbs.roleslist#" index="thisRole">
<cfloop query="application.rbs.permissionsQuery">
<cfscript>
application.rbs.permission["#id#"]["#thisRole#"] = application.rbs.permissionsQuery["#thisRole#"];
</cfscript>
</cfloop>
</cfloop>
</cfif>


<!--- Custom Overrides --->
<cfinclude template="/models/services/global/app/app.cfm">

</cfoutput>

Loading

0 comments on commit fbc7c85

Please sign in to comment.