configuration - Grails access current environment from within config.groovy -


using grails oauth plugin requires absolute callback url provided in config.groovy. have different serverurls each environment.

is there way current environment inside config.groovy, here's example of want do:

def devserverurl = 'http://dev.example.com' def prodserverurl = 'http://prod.example.com' def currentserverurl = grailsapplication.metadata.environment == 'development' ? devserverurl : prodserverurl;  environments {     development {         grails {             serverurl = devserverurl         }     }     production {         grails {             serverurl = prodserverurl         }     } }  oauth {     providers {         runkeeper {             api = runkeeperapi             key = 'key'             secret = 'secret'             callback = currentserverurl + '/oauth/runkeeper/callback'         }     } } 

any ideas? thanks!

try this:

def currentserverurl = environment.current.name == 'development' ? devserverurl : prodserverurl; 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -