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

Load the env from file for local use #5

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions env.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import os
from typing import List
from os.path import dirname, join
from dotenv import load_dotenv


def get_env_vars() -> tuple[str, str, List[str]]:
Expand All @@ -15,6 +17,10 @@ def get_env_vars() -> tuple[str, str, List[str]]:
str: the start date to get contributor information from
str: the end date to get contributor information to.
"""
# Load from .env file if it exists
dotenv_path = join(dirname(__file__), ".env")
load_dotenv(dotenv_path)

organization = os.getenv("ORGANIZATION")
repository = os.getenv("REPOSITORY")
# Either organization or repository must be set
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github3.py==4.0.1
python-dotenv==1.0.0
pytest==7.4.2
pytest-cov==4.1.0

pytest-cov==4.1.0