staging
This commit is contained in:
parent
502afe9827
commit
57fc83567d
@ -7,8 +7,8 @@ from v25.storage.dbstorage import DBStorage
|
|||||||
_d_type = Dict[Any, Union[str, Dict[str, Any]]]
|
_d_type = Dict[Any, Union[str, Dict[str, Any]]]
|
||||||
|
|
||||||
|
|
||||||
def get_config() -> _d_type:
|
def get_config(file: str) -> _d_type:
|
||||||
with open('config.json') as f:
|
with open(file) as f:
|
||||||
return json.load(f)
|
return json.load(f)
|
||||||
|
|
||||||
|
|
||||||
@ -17,11 +17,3 @@ def from_config(d: _d_type):
|
|||||||
subjects = d["subjects"]
|
subjects = d["subjects"]
|
||||||
for subject in subjects:
|
for subject in subjects:
|
||||||
storage.ssssj(subject, json.dumps(subjects[subject]))
|
storage.ssssj(subject, json.dumps(subjects[subject]))
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
from_config(get_config())
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
@ -1,7 +1,7 @@
|
|||||||
from flask import Flask
|
from flask import Flask
|
||||||
from werkzeug.middleware.dispatcher import DispatcherMiddleware
|
from werkzeug.middleware.dispatcher import DispatcherMiddleware
|
||||||
|
|
||||||
import config
|
import config25
|
||||||
from v25.storage.dbstorage import DBStorage
|
from v25.storage.dbstorage import DBStorage
|
||||||
from v25.web.server.api import API
|
from v25.web.server.api import API
|
||||||
|
|
||||||
@ -11,8 +11,8 @@ def simple(_env, resp):
|
|||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
d = config.get_config()
|
d = config25.get_config('dev-config.json')
|
||||||
config.from_config(d)
|
config25.from_config(d)
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.wsgi_app = DispatcherMiddleware(simple, {
|
app.wsgi_app = DispatcherMiddleware(simple, {
|
||||||
|
17
staging-config.json
Normal file
17
staging-config.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"db": "sqlite:///staging.db",
|
||||||
|
"subjects": {
|
||||||
|
"ro6ncuJxA_cGQ51hPKw11Q84of08j7GtOjL0Xr5GaFs=": {
|
||||||
|
"allowed": null,
|
||||||
|
"contacts": null
|
||||||
|
},
|
||||||
|
"oNNNAvX5nsJEQGf33xulhh27cpECgQtJT3jzu2VyNKY=": {
|
||||||
|
"allowed": null,
|
||||||
|
"contacts": null
|
||||||
|
},
|
||||||
|
"uLep1UFgMlYDaIM8MEgMYTDY6HWcUq6Y4VvkyglbGJ8=": {
|
||||||
|
"allowed": null,
|
||||||
|
"contacts": null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
22
staging-main.py
Normal file
22
staging-main.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
from flask import Flask
|
||||||
|
from werkzeug.middleware.dispatcher import DispatcherMiddleware
|
||||||
|
|
||||||
|
import config25
|
||||||
|
from v25.storage.dbstorage import DBStorage
|
||||||
|
from v25.web.server.api import API
|
||||||
|
|
||||||
|
|
||||||
|
def simple(_env, resp):
|
||||||
|
resp('404 OK', [])
|
||||||
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
d = config25.get_config('staging-config.json')
|
||||||
|
config25.from_config(d)
|
||||||
|
|
||||||
|
app = Flask(__name__)
|
||||||
|
app.wsgi_app = DispatcherMiddleware(simple, {
|
||||||
|
'/v25': API(__name__, DBStorage(d['db']).pushing())
|
||||||
|
})
|
||||||
|
app.config['ENV'] = 'staging'
|
||||||
|
app.run(port=5013)
|
Loading…
Reference in New Issue
Block a user