Skip to content
This repository has been archived by the owner on Feb 3, 2022. It is now read-only.

Commit

Permalink
Don't require 'GITHUB_API_TOKEN' and 'ZENHUB_API_TOKEN' to be set
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelad committed Oct 29, 2017
1 parent 8566d43 commit e378f74
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog][keepachangelog] and this project
adheres to [Semantic Versioning][semver].

## [Unreleased][unreleased]
### Changed
- Don't require `GITHUB_API_TOKEN` and `ZENHUB_API_TOKEN` to be set and log a
warning message if they're not.

## [v0.1.1][v0.1.1] - 2017-10-28
### Fixed
Expand Down
4 changes: 2 additions & 2 deletions src/zenboard/settings.py
Expand Up @@ -126,8 +126,8 @@


# API tokens
GITHUB_TOKEN = config('GITHUB_API_TOKEN')
ZENHUB_API_TOKEN = config('ZENHUB_API_TOKEN')
GITHUB_TOKEN = config('GITHUB_API_TOKEN', default='')
ZENHUB_API_TOKEN = config('ZENHUB_API_TOKEN', default='')


# Misc
Expand Down
12 changes: 12 additions & 0 deletions src/zenboard/utils.py
@@ -1,12 +1,17 @@
"""
zenboard utils
"""
import logging

from django.conf import settings
from github3 import GitHub

from zenhub_api import ZenHubAPI


logger = logging.getLogger(__name__)


class ValidateModelMixin:
"""
DRF mixin that calls Django model validation
Expand All @@ -18,10 +23,17 @@ def validate(self, attrs):
return attrs


if not settings.GITHUB_TOKEN:
logging.warning("GitHub API token not found")

github_api = GitHub(
token=settings.GITHUB_TOKEN,
)


if not settings.GITHUB_TOKEN:
logging.warning("ZenHub API token not found")

zenhub_api = ZenHubAPI(
token=settings.ZENHUB_API_TOKEN,
)

0 comments on commit e378f74

Please sign in to comment.