I'm having a go at my first koyo project. So far I've got an app up and running with a raco koyo console using the default credentials. I'm now attempting to get koyo to use the .env file for configuration. In the documentation, variables should be named <APP_NAME>_. However, I'm getting authentication issues with postgres because the app user has a non-default password. It looks like the .env file isn't getting loaded.
I edited the config.rkt and sure enough, it connected successfully. Obviously, I don't want to commit the actual credentials in the config.rkt. So how do I make sure the .env file is getting loaded?
raco koyo serve and raco koyo console don't attempt to load the .env file. If you created your project with raco koyo new, you'll have a Procfile in your root folder, which you can run with raco chief start (see the README.md in your generated project). chief loads the .env file and runs each entry in the Procfile. If you want to run raco koyo console with your .env file specifically, you can run raco chief run raco koyo console.
OK, so if I understand correctly, for development you're expecting config.rkt to hold the credentials and then for production you'd switch to chief and let that load off the .env?
The reverse. chief is intended to be used for development (see the Development environment and Running the app locally sections of the generated README.md) and config.rkt itself shouldn't contain any secrets, only config definitions and defaults. For production, I typically generate a distribution with raco koyo dist, ship it to a server and then use systemd to run it and set environment variables.
In terms of testing on CI do you see that coming from the config.rkt too?
Those should also be set by env vars. Here's an example:
In all cases, configuration is intended to come through config.rkt, but the actual configuration values are intended to be overwritten at runtime via environment variables depending on the context.
In that same file you can also see how a production distribution is packaged up and deployed (though using docker images instead of systemd in that particular case).
BTW if there's a better place for me to ask these questions I'm happy to go there. I just figured this was better than leaving you a bag of Github issues.