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

check $DATABASE_URL if no --url arg #135

Merged
merged 5 commits into from
Feb 2, 2025
Merged

Conversation

achristmascarl
Copy link
Owner

@achristmascarl achristmascarl commented Feb 2, 2025

checks $DATABASE_URL and .env file for a connection string url

closes #113


Important

Add support for checking DATABASE_URL environment variable and .env file for connection URL if --url is not provided.

  • Behavior:
    • In src/main.rs, if --url is not provided, check DATABASE_URL environment variable and .env file for connection URL.
    • Log message if DATABASE_URL is used from environment variable.
  • Dependencies:
    • Add dotenvy crate to Cargo.toml and Cargo.lock for environment variable support.
  • CI:
    • Update .github/workflows/ci.yml to ignore markdown file changes.

This description was created by Ellipsis for 9511dde. It will automatically update as commits are pushed.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Reviewed everything up to 59a5d0c in 9 seconds

More details
  • Looked at 29 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. src/main.rs:58
  • Draft comment:
    You can simplify the map_or usage by using ok:
    env::var("DATABASE_URL").ok()
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The use of map_or can be simplified with ok. This applies to other similar patterns as well.

Workflow ID: wflow_92jQV6fOreZ5aJLi


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Incremental review on 63fa005 in 21 seconds

More details
  • Looked at 49 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. src/main.rs:58
  • Draft comment:
    Loading the .env file using dotenvy is a good practice to ensure environment variables are available. Consider handling errors explicitly if loading the .env file is critical.
  • Reason this comment was not posted:
    Confidence changes required: 33%
    The dotenvy crate is used to load environment variables from a .env file, which is a common practice for managing environment-specific configurations. The dotenv function is called at the beginning of the tokio_main function to ensure that any environment variables defined in a .env file are loaded before they are accessed. This is a good practice and aligns with the issue's requirement to read from the .env file.
2. src/main.rs:61
  • Draft comment:
    Checking if the DATABASE_URL is empty before using it is a good practice to avoid potential issues with an empty URL.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The code checks if the DATABASE_URL environment variable is empty and returns None if it is. This is a good practice to avoid using an empty URL.

Workflow ID: wflow_uEKZV8QO2ZuAetuZ


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Incremental review on 10b78e5 in 24 seconds

More details
  • Looked at 16 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. README.md:153
  • Draft comment:
    Clarify the order of precedence for checking DATABASE_URL in the environment variable and .env file. The current description implies the environment variable is checked first, then the .env file.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The PR description mentions checking for DATABASE_URL in a .env file, but the README update only mentions checking the environment variable and .env file without specifying the order. This could be clarified.

Workflow ID: wflow_tFdO8WKlPqzr0KBb


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Incremental review on 9511dde in 15 seconds

More details
  • Looked at 16 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. .github/workflows/ci.yml:8
  • Draft comment:
    The paths-ignore feature is correctly used to ignore markdown files in both push and pull_request events. This is a good practice to avoid unnecessary CI runs for documentation changes.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The paths-ignore feature is correctly implemented to ignore markdown files in both push and pull_request events.

Workflow ID: wflow_XZgZ9sb6WNEsXXUu


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@achristmascarl achristmascarl merged commit 2b9115a into main Feb 2, 2025
8 checks passed
@achristmascarl achristmascarl deleted the feat/get-env-database-url branch February 2, 2025 21:06
Copy link

github-actions bot commented Feb 2, 2025

Included in release v0.2.12

tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Feb 6, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [achristmascarl/rainfrog](https://github.com/achristmascarl/rainfrog) | patch | `v0.2.11` -> `v0.2.13` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>achristmascarl/rainfrog (achristmascarl/rainfrog)</summary>

### [`v0.2.13`](https://github.com/achristmascarl/rainfrog/releases/tag/v0.2.13)

[Compare Source](achristmascarl/rainfrog@v0.2.12...v0.2.13)

<!-- Release notes generated using configuration in .github/release.yml at v0.2.13 -->

#### What's Changed

-   propogate DATABASE_URL when present by [@&#8203;achristmascarl](https://github.com/achristmascarl) in achristmascarl/rainfrog#138

**Full Changelog**: achristmascarl/rainfrog@v0.2.12...v0.2.13

### [`v0.2.12`](https://github.com/achristmascarl/rainfrog/releases/tag/v0.2.12)

[Compare Source](achristmascarl/rainfrog@v0.2.11...v0.2.12)

<!-- Release notes generated using configuration in .github/release.yml at v0.2.12 -->

#### KNOWN ISSUES

-   $DATABASE_URL doesn't work since the var wasn't used by the drivers; will be fixed in v0.2.13

#### What's Changed

-   bump sqlparser by [@&#8203;achristmascarl](https://github.com/achristmascarl) in achristmascarl/rainfrog#134
-   check $DATABASE_URL if no --url arg by [@&#8203;achristmascarl](https://github.com/achristmascarl) in achristmascarl/rainfrog#135

**Full Changelog**: achristmascarl/rainfrog@v0.2.11...v0.2.12

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xNTguMSIsInVwZGF0ZWRJblZlciI6IjM5LjE1OC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
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.

Read from $DATABASE_URL automatically
1 participant