示例#1
0
文件: deploy.py 项目: al4/orlo
    def start(self):
        """
        Start the deploy
        """
        args = [config.get('deploy_shell', 'command_path')]
        for p in self.release.packages:
            args.append("{}={}".format(p.name, p.version))
        app.logger.debug("Args: {}".format(str(args)))

        env = {
            'ORLO_URL': self.server_url,
            'ORLO_RELEASE': str(self.release.id)
        }
        for key, value in self.release.to_dict().items():
            my_key = "ORLO_" + key.upper()
            env[my_key] = json.dumps(value)

        app.logger.debug("Env: {}".format(json.dumps(env)))

        metadata = {}
        for m in self.release.metadata:
            metadata.update(m.to_dict())
        in_data = json.dumps(metadata)

        return self.run_command(
            args, env, in_data, timeout_sec=config.getint('deploy', 'timeout'))
示例#2
0
def get_token():
    """
    Get a token
    """
    ttl = config.getint('security', 'token_ttl')
    token = token_manager.generate(g.current_user, ttl)
    return jsonify({
        'token': token.decode('ascii'),
        'duration': config.get('security', 'token_ttl')
    })
示例#3
0
def get_token():
    """
    Get a token
    """
    ttl = config.getint('security', 'token_ttl')
    token = token_manager.generate(g.current_user, ttl)
    return jsonify({
        'token': token.decode('ascii'),
        'duration': config.get('security', 'token_ttl')
    })
示例#4
0
文件: app.py 项目: weargoggles/orlo
from orlo.exceptions import OrloStartupError

__author__ = 'alforbes'

app = Flask(__name__)

alembic = Alembic()
alembic.init_app(app)

app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv('SQLALCHEMY_DATABASE_URI',
                                                  config.get('db', 'uri'))
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False

if not app.config['SQLALCHEMY_DATABASE_URI'].startswith('sqlite'):
    # SQLite doesn't support these
    app.config['SQLALCHEMY_POOL_SIZE'] = config.getint('db', 'pool_size')
    app.config['SQLALCHEMY_POOL_RECYCLE'] = 2
    app.config['SQLALCHEMY_MAX_OVERFLOW'] = 10

if config.getboolean('flask', 'propagate_exceptions'):
    app.config['PROPAGATE_EXCEPTIONS'] = True

if config.getboolean('db', 'echo_queries'):
    app.config['SQLALCHEMY_ECHO'] = True

if not config.getboolean('flask', 'strict_slashes'):
    app.url_map.strict_slashes = False

# Debug mode ignores all custom logging and should only be used in
# local testing...
if config.getboolean('flask', 'debug'):
示例#5
0
文件: app.py 项目: al4/orlo
from orlo.exceptions import OrloStartupError


__author__ = 'alforbes'

app = Flask(__name__)

alembic = Alembic()
alembic.init_app(app)

app.config['SQLALCHEMY_DATABASE_URI'] = config.get('db', 'uri')
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False

if 'sqlite' not in app.config['SQLALCHEMY_DATABASE_URI']:
    # SQLite doesn't support these
    app.config['SQLALCHEMY_POOL_SIZE'] = config.getint('db', 'pool_size')
    app.config['SQLALCHEMY_POOL_RECYCLE'] = 2
    app.config['SQLALCHEMY_MAX_OVERFLOW'] = 10

if config.getboolean('flask', 'propagate_exceptions'):
    app.config['PROPAGATE_EXCEPTIONS'] = True

if config.getboolean('db', 'echo_queries'):
    app.config['SQLALCHEMY_ECHO'] = True

if not config.getboolean('main', 'strict_slashes'):
    app.url_map.strict_slashes = False

# Debug mode ignores all custom logging and should only be used in
# local testing...
if config.getboolean('flask', 'debug'):