-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Big refactor for better file structure
- Loading branch information
Showing
38 changed files
with
245 additions
and
543 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GITHUB_USER=supmanbot | ||
GITHUB_PSX="ha! wouldn't you like to know" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"python.pythonPath": "~/.virtualenvs/autognome/bin/python" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM python:3.6-alpine | ||
|
||
ENV PYTHONBUFFERED 1 | ||
|
||
# Requirements are installed here to ensure they will be cached. | ||
COPY ./requirements /requirements | ||
RUN pip install -r /requirements/local.txt | ||
|
||
COPY ./compose/remote/flask/entrypoint /entrypoint | ||
RUN sed -i 's/\r//' /entrypoint | ||
RUN chmod +x /entrypoint | ||
|
||
COPY ./compose/local/flask/start /start | ||
RUN sed -i 's/\r//' /start | ||
RUN chmod +x /start | ||
|
||
WORKDIR /app | ||
|
||
ENTRYPOINT ["/entrypoint"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
|
||
set -o errexit | ||
set -o pipefail | ||
set -o nounset | ||
|
||
/usr/local/bin/gunicorn --reload --bind 0.0.0.0:8000 --chdir=/app/gnome app:app --log-level debug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
|
||
set -o errexit | ||
set -o pipefail | ||
set -o nounset | ||
|
||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# from os import environ | ||
from envparse import env | ||
from .kms import string_or_b64kms | ||
|
||
|
||
class Env(object): | ||
def __call__(self, var, default=None, cast=None): | ||
value = env(var, default=default, cast=cast) | ||
return string_or_b64kms(value) | ||
|
||
# class Env(object): | ||
# """Wrapper around os.getenv with added AWS KMS encryption support.""" | ||
|
||
# def __call__(self, var, default=None): | ||
# value = environ.get(var, default) | ||
# return string_or_b64kms(value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import os | ||
import base64 | ||
import logging | ||
|
||
import boto3 | ||
|
||
BASE64_PREFIX = 'base64:' | ||
AWS_REGION = os.environ.get('AWS_REGION', None) | ||
|
||
|
||
def decrypt_kms_data(encrypted_data): | ||
"""Decrypt KMS encoded data.""" | ||
if not AWS_REGION: | ||
return | ||
|
||
kms = boto3.client('kms', region_name=AWS_REGION) | ||
|
||
decrypted = kms.decrypt(CiphertextBlob=encrypted_data) | ||
|
||
if decrypted.get('KeyId'): | ||
# Decryption succeed | ||
decrypted_value = decrypted.get('Plaintext', '') | ||
if isinstance(decrypted_value, bytes): | ||
decrypted_value = decrypted_value.decode('utf-8') | ||
return decrypted_value | ||
|
||
|
||
def string_or_b64kms(value): | ||
"""Check if value is base64 encoded - if yes, decode it using KMS.""" | ||
if not value: | ||
return value | ||
|
||
try: | ||
# Check if environment value base64 encoded | ||
if isinstance(value, (str, bytes)) and value.startswith(BASE64_PREFIX): | ||
value = value[len(BASE64_PREFIX):] | ||
# If yes, decode it using AWS KMS | ||
data = base64.b64decode(value) | ||
decrypted_value = decrypt_kms_data(data) | ||
|
||
# If decryption succeed, use it | ||
if decrypted_value: | ||
value = decrypted_value | ||
except Exception as e: | ||
logging.exception(e) | ||
return value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Load our conf | ||
from . import Env | ||
|
||
env = Env() | ||
|
||
DEBUG = env('DEBUG', default=False, cast=bool) | ||
GITHUB_USER = env('GITHUB_USER') | ||
GITHUB_PSX = env('GITHUB_PSX') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
sphinx | ||
paver | ||
cogapp | ||
-r ../src/requirements.txt | ||
-r ../requirements/base.txt |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from gnome.policies import Policy | ||
|
||
|
||
class SyncProjectMilestones(Policy): | ||
def dispatch_gnome(self): | ||
pass |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,8 @@ zappa | |
PyGithub | ||
requests | ||
ipaddress | ||
PyYAML | ||
PyYAML==3.12 | ||
pytest | ||
pylint | ||
python-dotenv | ||
envparse |
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.