Skip to content

Commit

Permalink
[ADD][IMP] Add Configurable Host&Port
Browse files Browse the repository at this point in the history
  • Loading branch information
gaetan1903 committed Feb 20, 2022
1 parent 6617fd8 commit 719cc9b
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Gaetan Jonathan BAKARY
Copyright (c) 2022 iTeam-$

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 3 additions & 3 deletions ampalibe/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .server import run
from .server import req
from .requete import Request
from .server import req as Req
from .messenger import Messenger
from .utils import action, commande
from .messenger import Messenger
from .requete import Request as Model
2 changes: 1 addition & 1 deletion ampalibe/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def run(cnf):
global _req
conf = cnf
_req = Model(cnf)
uvicorn.run(webserver)
uvicorn.run(webserver, port=cnf.APP_PORT, host=cnf.APP_HOST)


@webserver.get('/')
Expand Down
1 change: 0 additions & 1 deletion bin/ampalibe
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
#!/bin/bash

# script de creation sy config mety ty?
Empty file added bin/ampalibe.exe
Empty file.
4 changes: 4 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ project_urls =
Bug Tracker = https://github.com/iTeam-S/ampalibe/issues
classifiers =
Programming Language :: Python :: 3
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
License :: OSI Approved :: MIT License
Operating System :: OS Independent

Expand Down
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@
packages=setuptools.find_packages(), # List of all modules to be installed
classifiers=[
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
], # Information to filter the project on PyPi website
python_requires='>=3.6',
python_requires='>=3.7',
py_modules=["ampalibe"], # Name of the python package
install_requires=[
"fastapi", "uvicorn", "python-dotenv", "mysql-connector", "retry"], # depandance
Expand Down
3 changes: 3 additions & 0 deletions src/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ class Configuration:

ACCESS_TOKEN = env.get('AMP_ACCESS_TOKEN')
VERIF_TOKEN = env.get('AMP_VERIF_TOKEN')

APP_HOST = env.get('AMP_HOST')
APP_PORT = int(env.get('AMP_PORT'))
2 changes: 1 addition & 1 deletion src/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@param extends: contiennent la liste des autres
données envoyé par facebook (heure d'envoi, ...)
'''
req = ampalibe.req(Configuration())
req = ampalibe.Req(Configuration())
bot = ampalibe.Messenger(Configuration.ACCESS_TOKEN)


Expand Down
6 changes: 5 additions & 1 deletion src/example.env
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ AMP_VERIF_TOKEN=
DB_HOST=
DB_USER=
DB_PASSWORD=
DB_PORT=3306
DB_PORT=3306

### APPLICATION CONFIGURATION
AMP_HOST=0.0.0.0
AMP_PORT=4555
4 changes: 0 additions & 4 deletions src/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
sys.path.insert(0, os.path.dirname('/'.join(__file__.split('/')[:-1])))
if True:
import ampalibe
print(round(time.time() - t))
from conf import Configuration
print(round(time.time() - t))
import core
print(round(time.time() - t))
print(round(time.time() - t))
ampalibe.run(Configuration())

0 comments on commit 719cc9b

Please sign in to comment.