Skip to content

Commit

Permalink
ConfigurationHolder was deprecated, and removed from Grails 2.4.x. Fo…
Browse files Browse the repository at this point in the history
  • Loading branch information
danilat committed Feb 13, 2015
1 parent aa1a786 commit 2a405e8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
7 changes: 3 additions & 4 deletions application.properties
@@ -1,6 +1,5 @@
#Grails Metadata file
#Thu Feb 03 16:18:21 CET 2011
app.grails.version=1.3.6
#Fri Feb 13 21:39:40 CET 2015
app.grails.version=2.3.9
app.name=tropo-webapi-grails
plugins.hibernate=1.3.6
plugins.tomcat=1.3.6
app.servlet.version=2.5
8 changes: 4 additions & 4 deletions grails-app/conf/DataSource.groovy
@@ -1,6 +1,6 @@
dataSource {
pooled = true
driverClassName = "org.hsqldb.jdbcDriver"
driverClassName = "org.h2.Driver"
username = "sa"
password = ""
}
Expand All @@ -14,19 +14,19 @@ environments {
development {
dataSource {
dbCreate = "create-drop" // one of 'create', 'create-drop','update'
url = "jdbc:hsqldb:mem:devDB"
url = "jdbc:h2:mem:devDb"
}
}
test {
dataSource {
dbCreate = "update"
url = "jdbc:hsqldb:mem:testDb"
url = "jdbc:h2:mem:testDb"
}
}
production {
dataSource {
dbCreate = "update"
url = "jdbc:hsqldb:file:prodDb;shutdown=true"
url = "jdbc:h2:file:prodDb;shutdown=true"
}
}
}
9 changes: 4 additions & 5 deletions grails-app/services/com/tropo/grails/TropoService.groovy
Expand Up @@ -2,8 +2,6 @@ package com.tropo.grails

import java.util.Map

import org.codehaus.groovy.grails.commons.ConfigurationHolder;

/**
* This Grails service abstracts the access to the <a href="https://www.tropo.com/docs/rest/rest_api.htm">Tropo REST API</a>.</p>
*
Expand All @@ -12,6 +10,7 @@ import org.codehaus.groovy.grails.commons.ConfigurationHolder;
*/
class TropoService {

def grailsApplication
static transactional = true
def baseUrl
def httpHelper
Expand All @@ -27,18 +26,18 @@ class TropoService {
this.username = username
this.password = password

baseUrl = ConfigurationHolder?.config?.tropo?.api?.url
baseUrl = grailsApplication?.config?.tropo?.api?.url
if (!baseUrl) {
baseUrl = HARDCODED_BASE_URL
}

if (!username) {
// try to find it on grails config file
username = ConfigurationHolder?.config?.tropo?.username
username = grailsApplication?.config?.tropo?.username
}
if (!password) {
// try to find it on grails config file
username = ConfigurationHolder?.config?.tropo?.password
username = grailsApplication?.config?.tropo?.password
}

httpHelper = new HTTPHelper(username,password)
Expand Down

0 comments on commit 2a405e8

Please sign in to comment.