I bootstrapped an APP using Genie.
I chose the MySQL DB.
I edited the db/connection.yml file as required:
env: ENV["GENIE_ENV"]
dev:
adapter: MySQL
database: db
host: localhost
username: felipe
password: **********
port: 3306
config:
but when I try to manually load the database configuration include(joinpath("config","initializers","searchlight.jl"))
I have an error:
┌ Error: SystemError("opening file \"db/connection.yml\"", 2, nothing)
└ @ Main /home/felipe/Documents/julia/Genie/watchtonight/config/initializers/searchlight.jl:11
What is wrong with my configuration?
1 Like
goerch
November 23, 2021, 3:11pm
2
What does pwd()
show you?
show: “/home/felipe/Documents/julia/Genie”
then I tried:
include("/home/felipe/Documents/julia/Genie/watchtonight/config/initializers/searchlight.jl")
then, the same error occurred.
goerch
November 23, 2021, 5:22pm
4
But you see watchtonight
was missing in your first attempt? The error
Error: SystemError("opening file \"db/connection.yml\"", 2, nothing)
furthermore indicates a sub directory named db
is still missing?
The sub directory db
is not missing.
When I call the file .../searchlight.jl
it call another file named .../db/connection.yml
.
goerch
November 23, 2021, 5:54pm
6
Oh, OK. Maybe we should look into searchlight.jl
then?
the content of the file searchlight.jl
is:
using SearchLight
try
SearchLight.Configuration.load()
if SearchLight.config.db_config_settings["adapter"] !== nothing
eval(Meta.parse("using SearchLight$(SearchLight.config.db_config_settings["adapter"])"))
SearchLight.connect()
end
catch ex
@error ex
end
1 Like
goerch
November 23, 2021, 7:32pm
8
Thanks. I’m sorry, but I can’t imagine the environment this eval
is running in… ;(
1 Like
@goerch , i solved the problem.
I bootstrapped the APP again and changed localhost
to 127.0.0.1
env: ENV["GENIE_ENV"]
dev:
adapter: MySQL
database: db
host: 127.0.0.1
username: felipe
password: **********
port: 3306
config:
Thank you for your attention
1 Like
goerch
November 23, 2021, 9:07pm
10
Thanks for your feedback!
1 Like