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

Allow Umami to be configured with UMAMI_DATABASE_URL #3165

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

luizkowalski
Copy link

hey 👋🏻

Trying something here, TS is a language I'm comfortable with so let me know what needs to be updated too

Fixes #3078

Copy link

vercel bot commented Jan 8, 2025

@luizkowalski is attempting to deploy a commit to the umami-software Team on Vercel.

A member of the Team first needs to authorize it.

@mikecao
Copy link
Collaborator

mikecao commented Jan 10, 2025

It's not that simple. Those methods only do minor checks. The problem is Prisma expects DATABASE_URL and we would have to figure out how to change that.

@luizkowalski
Copy link
Author

hmm makes sense. I will dig Prisma docs and try something

@FHU-yezi
Copy link

I reserched the Prisma docs and found this related page: https://www.prisma.io/docs/orm/prisma-client/setup-and-configuration/introduction

Seems we should define which envronment variable being used in the schema file, so I found it in repo, take PostgreSQL for example:

url = env("DATABASE_URL")

This type of Prisma DSL does not support OR relation in key-value pair, but according to this doc: https://www.prisma.io/docs/orm/prisma-schema/overview/data-sources, we can override this in our code: https://www.prisma.io/docs/orm/reference/prisma-client-reference#programmatically-override-a-datasource-url

Related code in our repo:

  1. Check DB script:
    const prisma = new PrismaClient();
  2. Change password script:
    const prisma = new PrismaClient();

I'm not familiar with this repo, seems we should change this file: https://github.com/umami-software/umami/blob/master/src/lib/prisma.ts, to use a customized PrismaClient instead of the default one.

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.

Allow different env vars for the same configuration
3 participants