Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: migrate to postgresql #477

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

opeolluwa
Copy link
Collaborator

@ndelvalle I'm trying to dockerize this to make it easier to setup and run but the code panics,

 => => naming to docker.io/library/rustapi-app                                                                 0.0s 
[+] Running 2/0
 ✔ Container rustapi-database-1  Running                                                                       0.0s 
 ✔ Container rustapi-app-1       Recreated                                                                     0.0s 
Attaching to app-1, database-1
app-1       | thread 'main' panicked at src/settings.rs:7:34:
app-1       | Failed to setup settings: configuration file "config/default" not found
app-1       | note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
app-1 exited with code 101

Can we possibly revamp the application config using yaml like i did here https://github.com/opeolluwa/backend-in-rust/blob/master/02_auth_jwt/src/config.rs or best we use environment variables

@opeolluwa opeolluwa linked an issue Sep 24, 2024 that may be closed by this pull request
@ndelvalle
Copy link
Owner

@opeolluwa yeah I think having to ship config files is not ideal if you want to have a single binary. I think the way to go would be to just use env vars instead of any config file, not even use yaml.

@opeolluwa
Copy link
Collaborator Author

Awesome, I know we'd have a port, JWT signing key and database connection. Would that be all or there's more

@ndelvalle
Copy link
Owner

@opeolluwa Regarding the Docker image, I’m not completely sure. Initially, I wanted the project to include lots of features, but now days I’m leaning towards keeping it as simple as possible, is easier to mantain. If we do decide to include Docker, I think we should use the official Rust image tho.

@opeolluwa
Copy link
Collaborator Author

Hmmm

@ndelvalle
Copy link
Owner

Awesome, I know we'd have a port, JWT signing key and database connection. Would that be all or there's more

Here is what we use: https://github.com/ndelvalle/rustapi/blob/master/src/settings.rs.
I think that even if we don't ship a config file is cool to have a layered config to provide flexibility using https://github.com/mehcode/config-rs or or something similar.

@opeolluwa
Copy link
Collaborator Author

The primary reason for docker is because of the database, actually

@opeolluwa
Copy link
Collaborator Author

@ndelvalle would you mind docker or I should just use set up PostgreSQL locally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate to Postgresql
2 participants