Repository: truera/trulens
Issue: [BUG] Dashboard ignores `database_url` when opening Apps or Evaluations pages without opening Leaderboards first
Root cause: Configuration Error

**Bug Description**
I spent many hours figuring out why the Streamlit dashboard seemingly randomly ignores the `database_url` and falls back to using `default.sqlite`. Turns out, if you happen to have Apps or Evaluations page opened at the moment you execute `run_dashboard`, then the `Tru` singleton is initialized with the default constructor, ignoring your `database_url`.

**To Reproduce**
1. Run the dashboard with your own database URL:
```python
DB_URL = 'postgresql+psycopg://test:12345678@localhost/test'
tru = Tru(database_url=DB_URL)
tru.run_dashboard()
```

2. Go either to http://localhost:8501/Apps or http://localhost:8501/Evaluations.
3. The page will be empty (even if you already have something in the database) and you will see a `default.sqlite` file created in the project directory.

**Expected behavior**
`database_url` is respected regardless of which dashboard page you open first.

**Relevant Logs/Tracebacks**
In the [Leaderboard.py](https://github.com/truera/trulens/blob/main/trulens_eval/trulens_eval/Leaderboard.py) the `database_url` is initialized by argument parser:

https://github.com/truera/trulens/blob/75c583889775ad3289ff24c0f5db7b9532d9e7ec/trulens_eval/trulens_eval/Leaderboard.py#L155-L169

However, there is no such logic in [Apps](https://github.com/truera/trulens/blob/main/trulens_eval/trulens_eval/pages/Apps.py) and [Evaluation](https://github.com/truera/trulens/blob/main/trulens_eval/trulens_eval/pages/Evaluations.py) pages, so the default singleton constructor is used.

https://github.com/truera/trulens/blob/75c583889775ad3289ff24c0f5db7b9532d9e7ec/trulens_eval/trulens_eval/pages/Evaluations.py#L55-L56

This relies on having the Leaderboard page opened before others.

**Environment:**
 - OS: Linux
 - Python Version: 3.11.8
 - TruLens version: 0.26.0


<!-- Answer -->
It's great that you've identified this issue and provided a detailed description of the bug, along with relevant logs and tracebacks. Your understanding of the problem and its potential solution is valuable. If you're interested, we encourage you to create a pull request with your proposed fix to help improve the TruLens dashboard for everyone. Thank you for your contribution!


<!-- Dosu Comment Footer -->
<details open>
<summary>

#### About Dosu
</summary>

This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.
</details>

@piotrm0 can you take this one?

Hi @theoratkin , I believe I fixed this as part of another database-related PR (https://github.com/truera/trulens/pull/971). This should be in the next release but you can test with the PR version for now. Let me know if the issue persists.

Sorry for late reply, didn't have the chance to test it until now. Yes, it is indeed fixed now, thanks! Closing the issue.