Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add extras to make it releasable
- Loading branch information
Showing
7 changed files
with
77 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
from example_service.app import app # NOQA | ||
# from example_service.app import app # NOQA | ||
|
||
__version__ = '0.1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import argparse | ||
import sys | ||
import os | ||
import signal | ||
from .app import create | ||
|
||
|
||
def _quit(signal, frame): | ||
print('Shutting down!') | ||
sys.exit(0) | ||
|
||
|
||
def main(args=sys.argv[1:]): | ||
parser = argparse.ArgumentParser(description='Service Example') | ||
parser.add_argument('--config-file', help='Config file', | ||
type=str, default=None) | ||
args = parser.parse_args(args=args) | ||
|
||
if args.config_file is not None: | ||
os.environ.set('FLASK_SETTINGS', args.config_file) | ||
|
||
app = create() | ||
|
||
host = app.config.get('host', '0.0.0.0') | ||
host = os.environ.get('HOST', host) | ||
|
||
port = app.config.get('port', 5000) | ||
port = os.environ.get('PORT', port) | ||
|
||
debug = app.config.get('DEBUG', False) | ||
|
||
signal.signal(signal.SIGINT, _quit) | ||
signal.signal(signal.SIGTERM, _quit) | ||
|
||
app.run(debug=debug, host=host, port=port) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters