Skip to content

Commit

Permalink
extract common depencies between auth-api and auth-queue
Browse files Browse the repository at this point in the history
  • Loading branch information
bolyachevets committed Sep 7, 2024
1 parent 112a1c3 commit 5f7eddb
Show file tree
Hide file tree
Showing 10 changed files with 2,376 additions and 901 deletions.
841 changes: 469 additions & 372 deletions auth-api/poetry.lock

Large diffs are not rendered by default.

8 changes: 1 addition & 7 deletions auth-api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,8 @@ flask-migrate = "^4.0.7"
flask-moment = "^1.0.6"
flask-sqlalchemy = "^3.1.1"
flask-marshmallow = "^1.2.1"
flask = "3.0.2"
gunicorn = "^22.0.0"
python-dotenv = "^1.0.1"
jinja2 = "3.1.3"
pg8000 = "^1.31.2"
launchdarkly-server-sdk = "9.5.0"
flask-mail = "^0.10.0"
bcrypt = "^4.2.0"
pyhumps = "^3.8.0"
Expand All @@ -27,16 +23,14 @@ cachelib = "0.9.0"
minio = "^7.2.7"
aiohttp = "^3.10.2"
cattrs = "^23.2.3"
jsonschema = "4.17.3"
orjson = "^3.10.7"
sqlalchemy-utils = "^0.41.2"

# VCS dependencies
sbc-common-components = {git = "https://github.com/bcgov/sbc-common-components.git", subdirectory = "python", branch = "master"}
sql-versioning = { git = "https://github.com/bcgov/sbc-connect-common.git", subdirectory = "python/sql-versioning", branch = "main" }
flask-jwt-oidc = {git = "https://github.com/seeker25/flask-jwt-oidc.git", branch = "main" }
gcp-queue = { git = "https://github.com/bcgov/sbc-connect-common.git", subdirectory = "python/gcp-queue", branch = "main" }
structured_logging = { git = "https://github.com/bcgov/sbc-connect-common.git", subdirectory = "python/structured-logging", branch = "main" }
build-deps = { git = "https://github.com/bcgov/sbc-auth.git", rev = "feature-gcp-migration", subdirectory = "build-deps" }

[tool.poetry.group.test.dependencies]
psycopg2 = "^2.9.9"
Expand Down
2 changes: 1 addition & 1 deletion auth-api/src/auth_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
def create_app(run_mode=os.getenv("DEPLOYMENT_ENV", "production")):
"""Return a configured Flask App using the Factory method."""
app = Flask(__name__)
app.env = run_mode
app.config['ENV'] = run_mode
app.config.from_object(config.CONFIGURATION[run_mode])

CORS(app, resources="*")
Expand Down
4 changes: 2 additions & 2 deletions auth-api/src/auth_api/services/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ def init_app(self, app):
self.app = app
self.sdk_key = app.config.get("AUTH_LD_SDK_KEY")

if self.sdk_key or app.env != "production":
if self.sdk_key or app.config['ENV'] != "production":

if app.env == "testing":
if app.config['ENV'] == "testing":
factory = Files.new_data_source(paths=["flags.json"], auto_update=True)
config = Config(sdk_key=self.sdk_key, update_processor_class=factory, send_events=False)
else:
Expand Down
6 changes: 3 additions & 3 deletions auth-api/tests/unit/services/test_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def setup():
"""Initialize app with dev env for testing."""
global app
app = Flask(__name__)
app.env = "testing"
app.config['ENV'] = "testing"


def test_flags_constructor_no_app(setup):
Expand Down Expand Up @@ -69,7 +69,7 @@ def test_init_app_dev_no_key(setup):

def test_init_app_prod_with_key(setup):
"""Ensure that extension can be initialized with a key in prod."""
app.env = "production"
app.config['ENV'] = "production"
app.config["AUTH_LD_SDK_KEY"] = "https://no.flag/avail"

with app.app_context():
Expand All @@ -82,7 +82,7 @@ def test_init_app_prod_with_key(setup):

def test_init_app_prod_no_key(setup):
"""Ensure that extension can be initialized with no key in prod."""
app.env = "production"
app.config['ENV'] = "production"
app.config["AUTH_LD_SDK_KEY"] = None

with app.app_context():
Expand Down
Empty file.
1,286 changes: 1,286 additions & 0 deletions build-deps/poetry.lock

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions build-deps/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[tool.poetry]
name = "build-deps"
version = "1.0.0"
description = "common dependencies for all auth tools"
authors = ["BC Registries and Online Services"]

[tool.poetry.dependencies]
attrs = "24.2.0"
CacheControl = "0.14.0"
cachetools = "5.5.0"
certifi = "2024.8.30"
flask = "3.0.2"
itsdangerous = "2.1.2"
jinja2 = "3.1.3"
jsonschema = "4.17.3"
launchdarkly-server-sdk = "9.5.0"
MarkupSafe = "2.1.1"
python = "^3.12"
python-dotenv = "^1.0.1"
requests = "2.32.3"
Werkzeug = "3.0.0"

sbc-common-components = { git = "https://github.com/bcgov/sbc-common-components.git", rev = "master", subdirectory = "python" }
gcp-queue = { git = "https://github.com/bcgov/sbc-connect-common.git", subdirectory = "python/gcp-queue", branch = "main" }

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
Loading

0 comments on commit 5f7eddb

Please sign in to comment.