Wednesday, July 28, 2010

Accessing appName property from controller in Grails

It is trivial to access the appName property from within the config.groovy file, and it is a common practice to do so. Here is an example of specifying an external config file based on the name of the grails application:

grails.config.locations = ["file:$userHome/.osaas/$appName.groovy"


I could find no where obvious that described how to access this appName property from a constructor. You would expect the following to work but it does not:

grailsApplication.config.appName


The following does work however

grailsApplication.metadata['app.name']

Monday, July 5, 2010

Tracing DNS resolution

When you need to trace how dns is resolving your server here is a way to do it.
First run this nslookup query:

nslookup -q=ns example.com a.root-servers.net
Authoritative answers can be found from:
com nameserver = h.gtld-servers.net.
com nameserver = d.gtld-servers.net.
com nameserver = k.gtld-servers.net.
com nameserver = g.gtld-servers.net.
com nameserver = c.gtld-servers.net.
com nameserver = f.gtld-servers.net.
com nameserver = j.gtld-servers.net.


Now choose one of the results and run the query again like this:

nslookup -q=ns example.com a.gtld-servers.net
Authoritative answers can be found from:
example.com nameserver = ns1.example.com.
example.com nameserver = ns2.example.com.
example.com nameserver = ns3.example.com.
ns1.example.com internet address = 10.12.12.12


You can repeat the above if you still haven't reached your destination