Use cfwheels from another context

37 views
Skip to first unread message

Steven Kelly

unread,
Apr 21, 2021, 3:53:31 AM4/21/21
to CFWheels
Hello there,

here's the situation: We have 2 applications, one for customers, one for administration. The admin application runs in a different context.
The problem is that we have to use a function from the regular application in the admin context. When we do so, the admin context doesn't know anything about cfwheels, so when trying to use things like models, it fails.
The call looks as following: \admin\cfc\doSomething.cfc --> calls \miscellaneous\anything.cfc --> calls \controllers\translate.cfc --> send an email...
Is there a way to externally initialize cfwheels from other applications?

Thanks,
Steven

Tom King

unread,
Apr 21, 2021, 4:14:31 AM4/21/21
to CFWheels
When you say context, I'm going to assume you mean two separate sites, with their own webroots, application scopes, etc.
I can't help feeling that a more formalized API between the two disparate systems would be more appropriate. You probably could rig something up by sharing scopes, or extending applications, or even via server scope, but it would potentially create more issues than it solves - i.e, if you had to ever cluster to more than one machine, or move siteA -> serverB etc. There's presumably authentication risks and "literal" scope creep (Application A unintentionally affecting Application B) etc too.

I would setup a controller with a bunch of endpoints as an internal use API which require some sort of authentication on your wheels side, and use cfhttp to POST/GET what you need from the other application. The advantage being that your interaction with the Wheels application would then be more considered, more easily documented and restricted in terms of it's operation.

Just my 2c!
T

Steven Kelly

unread,
Apr 21, 2021, 4:30:51 AM4/21/21
to CFWheels
That makes a lot of sense actually. Hadn't even considered that. Thanks!
Reply all
Reply to author
Forward
0 new messages