Skip to content

Commit

Permalink
Refactor config and initialization code
Browse files Browse the repository at this point in the history
  • Loading branch information
alguadam committed Sep 30, 2024
1 parent 976823e commit 18c31e3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
7 changes: 2 additions & 5 deletions config.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
from dotenv import load_dotenv
import os

load_dotenv()

class Config(object):
SECRET_KEY = 'this-really-needs-to-be-changed'
class Config(object):
SQLALCHEMY_TRACK_MODIFICATIONS = False
DEBUG = False

class LocalConfig(Config):
SQLALCHEMY_DATABASE_URI = 'sqlite:///local.db'
Expand Down
6 changes: 0 additions & 6 deletions iebank_api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_cors import CORS
from dotenv import load_dotenv
import os

app = Flask(__name__)

load_dotenv()

# Select environment based on the ENV environment variable
if os.getenv('ENV') == 'local':
print("Running in local mode")
Expand All @@ -18,9 +15,6 @@
elif os.getenv('ENV') == 'ghci':
print("Running in github mode")
app.config.from_object('config.GithubCIConfig')
else:
print("Running in production mode")
app.config.from_object('config.ProductionConfig')

db = SQLAlchemy(app)

Expand Down

0 comments on commit 18c31e3

Please sign in to comment.