Skip to content

Commit 657e717

Browse files
authored
Merge pull request #22 from ComputerScienceHouse/mom/dev
bumps and auth fix
2 parents 1e037f0 + 137f871 commit 657e717

File tree

9 files changed

+340
-117
lines changed

9 files changed

+340
-117
lines changed

.github/workflows/python-app.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Linting and tests
2+
3+
on:
4+
push:
5+
branches: [master, mom/dev]
6+
pull_request:
7+
branches: [master, mom/dev]
8+
9+
jobs:
10+
check:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
python-version: [3.13]
16+
17+
steps:
18+
- name: Install ldap dependencies
19+
run: sudo apt-get update && sudo apt-get install libldap2-dev libsasl2-dev
20+
- uses: actions/checkout@v5
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v6
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
cache: 'pip'
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
30+
mypy --non-interactive --install-types
31+
- name: Lint with pylint
32+
run: |
33+
pylint app.py config.env.py eac
34+
- name: Typecheck with mypy
35+
run: |
36+
mypy app.py config.env.py eac
37+
- name: Format with yapf
38+
run: |
39+
yapf --diff -r app.py config.env.py eac
40+
41+
docker-build:
42+
runs-on: ubuntu-latest
43+
44+
steps:
45+
- uses: actions/checkout@v5
46+
47+
- name: Build Image
48+
run: |
49+
docker build . --file Dockerfile

.mypy.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[mypy]
2+
disable_error_code = import
3+
disallow_untyped_defs = True

.pylintrc

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,21 @@ disable =
99
duplicate-code,
1010
no-member,
1111
parse-error,
12-
bad-continuation,
1312
too-few-public-methods,
1413
global-statement,
1514
cyclic-import,
1615
locally-disabled,
1716
file-ignored
1817

1918
[REPORTS]
20-
output-format = text
21-
files-output = no
19+
output-format = colorized
2220
reports = no
2321

2422
[FORMAT]
2523
max-line-length = 120
26-
max-statement-lines = 75
2724
single-line-if-stmt = no
28-
no-space-check = trailing-comma,dict-separator
2925
max-module-lines = 1000
3026
indent-string = ' '
31-
string-quote=single-avoid-escape
32-
triple-quote=single
33-
docstring-quote=double
3427

3528
[MISCELLANEOUS]
3629
notes = FIXME,XXX,TODO
@@ -76,9 +69,6 @@ good-names=logger,id,ID
7669
# Bad variable names which should always be refused, separated by a comma
7770
bad-names=foo,bar,baz,toto,tutu,tata
7871

79-
# List of builtins function names that should not be used, separated by a comma
80-
bad-functions=apply,input
81-
8272
[DESIGN]
8373
max-args = 10
8474
ignored-argument-names = _.*
@@ -92,4 +82,4 @@ min-public-methods = 2
9282
max-public-methods = 20
9383

9484
[EXCEPTIONS]
95-
overgeneral-exceptions = Exception
85+
overgeneral-exceptions = builtins.Exception

.travis.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@ RUN --mount=type=bind,source=requirements.txt,target=requirements.txt \
1616
COPY . /opt/eac
1717

1818
RUN ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
19+
RUN git config --system --add safe.directory /opt/eac
1920

2021
ARG PORT=8080
2122
ENV PORT=${PORT}
2223
EXPOSE ${PORT}
2324

24-
CMD ["gunicorn app:application --bind=0.0.0.0:${PORT} --access-logfile=- --timeout=600"]
25+
# --access-logfile - prints access log to stdout
26+
# --error-log - prints errors to stdout
27+
# --capture-output logging and print go to error log (stdout)
28+
CMD ["sh", "-c", "gunicorn app:application --bind=0.0.0.0:${PORT} --access-logfile - --error-log - --capture-output --timeout=600"]

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,16 @@ pip3 install -r requirements.txt
3535
3636
flask run -h localhost -p 5000
3737
```
38+
39+
### Linting
40+
```
41+
# Install types
42+
mypy --install-types
43+
44+
# Check linting
45+
mypy app.py config.env.py eac
46+
# Check Typing
47+
pylint app.py config.env.py eac
48+
# Format
49+
yapf -ir app.py config.env.py eac
50+
```

config.env.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
IP = os.environ.get('IP', '127.0.0.1')
66
PORT = os.environ.get('PORT', 5000)
77
SERVER_NAME = os.environ.get('SERVER_NAME', 'localhost:5000')
8-
SECRET_KEY = os.environ.get('SESSION_KEY', default=''.join(secrets.token_hex(16)))
8+
SECRET_KEY = os.environ.get('SESSION_KEY',
9+
default=''.join(secrets.token_hex(16)))
910

1011
# OpenID Connect SSO config
11-
OIDC_ISSUER = os.environ.get('OIDC_ISSUER', 'https://sso.csh.rit.edu/auth/realms/csh')
12+
OIDC_ISSUER = os.environ.get('OIDC_ISSUER',
13+
'https://sso.csh.rit.edu/auth/realms/csh')
1214
OIDC_CLIENT_CONFIG = {
1315
'client_id': os.environ.get('OIDC_CLIENT_ID', ''),
1416
'client_secret': os.environ.get('OIDC_CLIENT_SECRET', ''),
@@ -28,17 +30,23 @@
2830
# GitHub secrets
2931
GITHUB_CLIENT_ID = os.environ.get('GITHUB_ID', '')
3032
GITHUB_SECRET = os.environ.get('GITHUB_SECRET', '')
31-
ORG_TOKEN = os.environ.get('GITHUB_ORG_TOKEN', '')
33+
GITHUB_APP_ID = os.environ.get('GITHUB_APP_ID', '')
34+
GITHUB_APP_PRIVATE_KEY = os.environ.get('GITHUB_APP_PRIVATE_KEY', '')
3235

3336
# Twitch secrets
3437
TWITCH_CLIENT_ID = os.environ.get('TWITCH_CLIENT_ID', '')
3538
TWITCH_CLIENT_SECRET = os.environ.get('TWITCH_CLIENT_SECRET', '')
3639

3740
# Twitter secrets
3841
TWITTER_CONSUMER_KEY = os.environ.get('TWITTER_OAUTH_CONSUMER_KEY', '')
39-
TWITTER_CONSUMER_SECRET_KEY = os.environ.get('TWITTER_OAUTH_CONSUMER_SECRET_KEY', '')
42+
TWITTER_CONSUMER_SECRET_KEY = os.environ.get(
43+
'TWITTER_OAUTH_CONSUMER_SECRET_KEY', '')
4044
TWITTER_TOKEN = os.environ.get('TWITTER_OAUTH_TOKEN', '')
4145
TWITTER_TOKEN_SECRET = os.environ.get('TWITTER_OAUTH_TOKEN_SECRET', '')
4246

4347
# Common secrets
4448
STATE = os.environ.get('STATE', 'auth')
49+
50+
# Connection controls
51+
REQUEST_TIMEOUT = os.environ.get("EAC_REQUEST_TIMEOUT",
52+
60) # default to a minute timeout

0 commit comments

Comments
 (0)