-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathSpudMediaGrailsPlugin.groovy
47 lines (40 loc) · 1.63 KB
/
SpudMediaGrailsPlugin.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import org.codehaus.groovy.grails.web.context.ServletContextHolder as SCH
class SpudMediaGrailsPlugin {
def version = "0.6.6"
def grailsVersion = "2.3 > *"
def loadAfter = ['spud-core']
def title = "Spud Media Plugin"
def author = "David Estes"
def authorEmail = "[email protected]"
def description = 'Provides Media management for Spud'
def documentation = "https://github.com/spud-grails/spud-media"
def license = "APACHE"
def organization = [name: "Bertram Labs", url: "http://www.bertramlabs.com/"]
def issueManagement = [system: "GITHUB", url: "https://github.com/spud-grails/spud-media/issues"]
def scm = [url: "https://github.com/spud-grails/spud-media"]
def doWithSpring = {
applyDefaultConfiguration(application.config)
}
def onConfigChange = { event ->
applyDefaultConfiguration(application.config)
}
def applyDefaultConfiguration(config) {
def selfieConf = config.grails.plugin.selfie
if (selfieConf.domain.containsKey('spudMedia') || selfieConf.containsKey('storage')) {
return
}
def karmanConf = config.grails.plugin.karman
def mapping = karmanConf.serveLocalMapping ?: 'storage'
def basePath = karmanConf.storagePath ?: 'storage'
selfieConf.domain.spudMedia = [
storage: [
bucket: 'default',
providerOptions: [
provider:'local',
basePath: basePath,
baseUrl:"http://localhost:8080${SCH.servletContext?.contextPath ?: ''}/${mapping}"
]
]
]
}
}