Grails OAuth プラグインを使用するには、絶対コールバック URL を Config.groovy で指定する必要があります。ただし、環境ごとに異なるサーバー URL があります。
Config.groovy 内から現在の環境を取得する方法はありますか。これが私がやりたいことの例です。
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'
}
}
}
何か案は?ありがとう!