I'd like to use db4o inside Griffon app, but I've problem with configuration:
how to set up plugin to not delete dbFile during AppShutdown.
There is some info about configuration at plugin page:
def configure(EmbeddedConfiguration configuration) {dataSource.delete=???}
but hot exactly set datasource.delete = 'false'?
Thanks for your help.
panKonrad.
Look closely at the different environments defined in Db4oConfig.groovy; you'll notice that the production environment does not delete the database file. That's exactly how you would need to set it up in your custom environment. By default both the development and test environment will delete the file.
Related
I have some variables that depend on the environment. They don't belong to a deps library but the only way I know is to import them like if they were.
I import them them in config.exs like this:
config :martin,
url: "http://localhost:4001"
I then define the different urls for production and staging in staging.exs and prod.exs and it is working fine.
But I get this warning for each of the variables I import this way
You have configured application :martin in your configuration
file, but the application is not available.
This usually means one of:
1. You have not added the application as a dependency in a mix.exs file.
2. You are configuring an application that does not really exist.
Please ensure :martin exists or remove the configuration.
Is there a way to do it in a more correct way that won't trigger a warning?
You can use the name of your app instead...
config :my_app,
martin_url: "http://localhost:4001"
I am not able to access web-app folder files in Grails 3.
I have robots.txt in the web-app folder and in Grails 2 I was able to access it directly at http://localhost:8080/robots.txt. After migrating to Grails 3 I am not able to access it anymore at http://localhost:8080/robots.txt.
How can I make these files accessible again?
See https://github.com/grails/grails-core/releases/tag/v3.0.12 and part Location of static resources
In Grails 3 you can store your files under src/main/resources. You can access them by filename preceded with static for example http://localhost:8080/static/robots.txt.
This path can be changed using config option as defined in attached URL
I faced a similar problem in Grails 3.3.1. I had the necessity to access a file template to use it with a plugin (excel-export plugin). After reading the documentation, I put the file under src/main/resources. It worked with OK in development mode (grails run-app), but I received an error in production environment (grails war). After a lot of reading, I've found the way to make it work. I've let the file in the same directory (src/main/resources), and then, in my controller:
def template = this.class.classLoader.getResource('myExcelFile.xlsx')
def path = template.file //will give you the real path to your file
Having the path, you can then open a stream or do what you need to do. In my case, use it whith the plugin:
new WebXlsxExporter(path).with {
setResponseHeaders(response)
add(products, withProperties)
save(response.outputStream)
}
I am working with Grails 2.4.2 and Tomcat 7 in Debian server.
Suppose I need to change a label of a field. If I change the label in server's view directory it is not working.
All I have to do is creating war again and deploy. But so far as I know, if any changes made in views no need to create war and deploy again.
In my opinion, the best way to deal with any dynamic content is to externalize it. Save the dynamic content into an external file where you can modify it. Grails' reloadable configuration could be of a great help. See http://www.tothenew.com/blog/externalize-and-reload-grails-configuration-dynamically/ to get an idea how this could be done.
Here is the problem:
For the sake of multiple developers and development environments (developer dependent, developer VM, dev, qa, stage, prod), I want to be able to use application.properties file to inject app confiugration into Config.groovy. Reason why it works for us is that we are using same file for injecting settings in Spring's applicationContext.xml file. I've been trying to accomplish this by follwing in Config.groovy, but still not geting value for neo4j.url from application properties.
grails.config.locations = [
"classpath:application.properties",
"file:${baseDir}/application.properties",
"file:${basedir}/application.properties"
]
println "neo4j url : ${grailsApplication.config.neo4j.url}"
println "neo4j url : ${neo4j.url}"
There must be something I'm doing wrong..
Problem was that I was printing values in Config.groovy, once application loaded everything worked fine, as expected, case closed tnx to Igor.
As sf_sandbox has set up the symfony environment, why not develop in the sandbox directly and then upload on to server? What are the disadvantages of sandbox compared with configuring manually?
I think there is no drawback in following this approach. sf_sandbox is a pre-configured symfony project. One of the pluses is that is saves you time in creating your project and initializing an empty application (by default this is called frontend).
It's more a matter of taste rather than a matter of right or wrong. It's up to you!
Note: If you follow this approach you have to make some initial configuration (steps 1,2,3 would be done anyway if you started your project from scratch):
Rename the project
Change the config/properties.ini file
Change the config/databases.yml file (by default sf_sandbox uses sqlite database)
Remove the data/sandbox.db database file