Skip to content

Instantly share code, notes, and snippets.

@modius
Last active December 25, 2015 11:19
Show Gist options
  • Save modius/6968057 to your computer and use it in GitHub Desktop.
Save modius/6968057 to your computer and use it in GitHub Desktop.
Setting machine specific attributes.
<cffunction
name="setMachineAttributes" access="private" returntype="void" output="true"
hint="Sets machine specific variables as needed.">
<!--- developer/staging specific variables are overridden here --->
<cfset var machineName=createObject("java", "java.net.InetAddress").localhost.getHostName()>
<cfswitch expression="#machinename#">
<!--- modius machine --->
<cfcase value="Greyhame.local,greyhame.daemon.com.au,Olorin.local,olorin.daemon.com.au">
<cfset this.datasource = "myrailoapp-local" />
<cfset application.dsn = "myrailoapp-local" />
<!--- set up amazon SIMPLEDB resource --->
<cfset application.aws = structNew() />
<cfset application.aws.accessKeyId = "TOPSECRET" />
<cfset application.aws.awsSecretKey = "ULTRASECRET" />
<cfset application.aws.region = "sdb.ap-southeast-2.amazonaws.com" />
</cfcase>
<cfdefaultcase>
<!--- cloudbees infrastructure --->
<cfset this.datasource = "myrailoapp-db" />
<cfset application.dsn = "myrailoapp-db" />
<!--- set up amazon SIMPLEDB resource --->
<cfset application.aws = structNew() />
<cfset application.aws.accessKeyId = "TOPSECRET" />
<cfset application.aws.awsSecretKey = "ULTRASECRET" />
<cfset application.aws.region = "sdb.amazonaws.com" />
</cfdefaultcase>
</cfswitch>
<!--- need your machine name? try this...
<cfoutput><h2>machinename: #machinename#</h2></cfoutput>
<cfdump var="#this#">
<cfabort> --->
<cfreturn />
</cffunction>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment