Configuring Our Site To Use Our Database
Last updated
Last updated
Just like we configured MySQL Workbench to connect to our database, we need to configure our BoxLang server to connect to it as well.
Open your ongoingWork folder in VSCode.
In the file menu on the left side, find the file called .cfconfig.json. This is a special configuration file that CommandBox feeds into our BoxLang server when it starts up. In it we can define datasources, mapped drives and a number of other settings.
Notice how in the .cfconfig.json file, there is a section called datasources
Replace where it says **DSOURCENAME** with your username ( first_last ).
Notice the other values which are in a format like ${}? These are for server names, usernames and passwords BUT you don't want to check those values into a git repo because you don't want them shared. So what does that format mean? Those values are being pulled from another file called .env
which does not get checked into the git repo.
Open up the .env
file.
Put the appropriate values into the .env file and save it. Something like this but with your values:
The last step is to open the file Application.bx and add the line this.datasource = 'Username' where Username is the username I sent your, not the actual word username.
In CommandBox, in your ongoingWork folder, restart your server by typing server restart
.