Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
yubarajshrestha committed Jun 10, 2022
1 parent ecf3986 commit 93ac49e
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Instant Articles

<p align="center">
<img src="https://banners.beyondco.de/instant-article.png?theme=light&packageManager=pip+install&packageName=masonite-instant-article&pattern=topography&style=style_1&description=File management solution for Masonite&md=1&showWatermark=1&fontSize=100px&images=https%3A%2F%2Fgblobscdn.gitbook.com%2Fspaces%2F-L9uc-9XAlqhXkBwrLMA%2Favatar.png">
<img src="https://banners.beyondco.de/Masonite%20Instant%20Article.png?theme=light&packageManager=pip+install&packageName=masonite-instant-article&pattern=charlieBrown&style=style_2&description=generate%20facebooks%20instant%20articles%20and%20feeds.&md=1&showWatermark=1&fontSize=100px&images=adjustments&widths=50&heights=50">
</p>

<p align="center">
Expand Down
9 changes: 0 additions & 9 deletions config

This file was deleted.

56 changes: 56 additions & 0 deletions config/database.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
from masonite.environment import LoadEnvironment, env
from masoniteorm.connections import ConnectionResolver

# Loads in the environment variables when this page is imported.
LoadEnvironment()

"""
The connections here don't determine the database but determine the "connection".
They can be named whatever you want.
"""
DATABASES = {
"default": env("DB_CONNECTION", "sqlite"),
"sqlite": {
"driver": "sqlite",
"database": env("SQLITE_DB_DATABASE", "masonite.sqlite3"),
"prefix": "",
"log_queries": env("DB_LOG"),
},
"mysql": {
"driver": "mysql",
"host": env("DB_HOST"),
"user": env("DB_USERNAME"),
"password": env("DB_PASSWORD"),
"database": env("DB_DATABASE"),
"port": env("DB_PORT"),
"prefix": "",
"grammar": "mysql",
"options": {
"charset": "utf8mb4",
},
"log_queries": env("DB_LOG"),
},
"postgres": {
"driver": "postgres",
"host": env("DB_HOST"),
"user": env("DB_USERNAME"),
"password": env("DB_PASSWORD"),
"database": env("DB_DATABASE"),
"port": env("DB_PORT"),
"prefix": "",
"grammar": "postgres",
"log_queries": env("DB_LOG"),
},
"mssql": {
"driver": "mssql",
"host": env("MSSQL_DATABASE_HOST"),
"user": env("MSSQL_DATABASE_USER"),
"password": env("MSSQL_DATABASE_PASSWORD"),
"database": env("MSSQL_DATABASE_DATABASE"),
"port": env("MSSQL_DATABASE_PORT"),
"prefix": "",
"log_queries": env("DB_LOG"),
},
}

DB = ConnectionResolver().set_connection_details(DATABASES)
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
masonite>=4,<5
masonite-orm>=2,<3
black==22.3.0
flake8==4.0.1
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version='0.0.7',
version='0.0.8',
packages=[
'instant_article',
'instant_article.config',
Expand Down Expand Up @@ -81,4 +81,4 @@
package_data={
'templates/index.html': [],
},
)
)
1 change: 1 addition & 0 deletions src/instant_article/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# flake8: noqa F401
from .providers.instant_article_provider import InstantArticleProvider
3 changes: 2 additions & 1 deletion src/instant_article/config/instant_article.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
| Masonite Instant Articles
|--------------------------------------------------------------------------
|
| You can configure various routes for either rss feeds or instant articles depending upon your needs.
| You can configure various routes for either rss feeds or
| instant articles depending upon your needs.
|
"""

Expand Down
1 change: 1 addition & 0 deletions src/instant_article/providers/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# flake8: noqa F401
from .instant_article_provider import InstantArticleProvider
1 change: 1 addition & 0 deletions src/instant_article/routes/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# flake8: noqa F401
from .route import ROUTES
3 changes: 2 additions & 1 deletion tests/integrations/config/instant_article.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
| Masonite Instant Articles
|--------------------------------------------------------------------------
|
| You can configure various routes for either rss feeds or instant articles depending upon your needs.
| You can configure various routes for either rss feeds or
| instant articles depending upon your needs.
|
"""

Expand Down

0 comments on commit 93ac49e

Please sign in to comment.