Skip to content

Commit 7e37046

Browse files
committed
Binding variable config to Console and Shell
Closes gh-709
1 parent e4023d2 commit 7e37046

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

grace-console/src/main/groovy/grails/ui/console/GrailsConsole.groovy

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2023 the original author or authors.
2+
* Copyright 2014-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,6 +34,7 @@ import grails.util.GrailsVersion
3434
* The Grails console runs Grails embedded within a Swing console instead of within a container like Tomcat
3535
*
3636
* @author Graeme Rocher
37+
* @author Michael Yan
3738
* @since 3.0
3839
*/
3940
@CompileStatic
@@ -70,6 +71,7 @@ class GrailsConsole extends Grails {
7071
Binding binding = new Binding()
7172
binding.setVariable('app', this)
7273
binding.setVariable('ctx', context)
74+
binding.setVariable('config', grailsApplication.getConfig())
7375
binding.setVariable(GrailsApplication.APPLICATION_ID, grailsApplication)
7476
bindingCustomizers?.each { customizer -> customizer.customize(binding) }
7577

grace-console/src/main/groovy/grails/ui/shell/GrailsShell.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import grails.persistence.support.PersistenceContextInterceptor
3333
* A Shell
3434
*
3535
* @author Graeme Rocher
36+
* @author Michael Yan
3637
* @since 3.0
3738
*/
3839
@CompileStatic
@@ -72,6 +73,7 @@ class GrailsShell extends Grails {
7273
Binding binding = new Binding()
7374
binding.setVariable('app', this)
7475
binding.setVariable('ctx', context)
76+
binding.setVariable('config', grailsApplication.getConfig())
7577
binding.setVariable(GrailsApplication.APPLICATION_ID, grailsApplication)
7678
bindingCustomizers?.each { customizer -> customizer.customize(binding) }
7779

0 commit comments

Comments
 (0)