Skip to content

Commit

Permalink
Merge pull request #5 from github/env-load
Browse files Browse the repository at this point in the history
Load the env from file for local use
  • Loading branch information
zkoppert committed Oct 6, 2023
2 parents 1c9df51 + dc0666d commit 1abd215
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
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

0 comments on commit 1abd215

Please sign in to comment.