Example #1
0
import os
from simpleutil.config import cfg

CONF = cfg.CONF

wsgi_server_options = [
    cfg.StrOpt('wsgi_user', default='nginx', help='Wsgi Server run user'),
    cfg.StrOpt('wsgi_group', default='nginx', help='Wsgi Server run group'),
    cfg.IntOpt(
        'wsgi_process',
        default=1,
        min=1,
        max=255,  # snowflake id limit process max number
        help='The number of worker processes to serve the '
        'wsgi application'),
    cfg.IPOpt(
        'bind_ip',
        version=4,  # just ipv4
        default='0.0.0.0',  # nosec : Bind to all interfaces by
        # default for backwards compatibility.
        help='The IP address of the network interface for the '
        'wsgi application listen on.'),
    cfg.PortOpt('bind_port',
                default=7999,
                help='The port number which the wsgi application listens '
                'on.'),
    cfg.StrOpt('unix_socket_file', help='Listen on unix socket file'),
    cfg.StrOpt('paste_config',
               default='simpleservice-paste.ini',
               help='Name of the paste configuration file that defines '
               'the available pipelines.'),
Example #2
0
from simpleutil.config import cfg
from simpleutil.config import types

client_opts = [
    cfg.HostnameOrIPOpt('gcenter',
                        default='127.0.0.1',
                        help='Hostname or IP address of gcenter wsgi service'),
    cfg.PortOpt('gcenter_port',
                default=7999,
                help='Http port of gcenter wsgi service'),
    cfg.StrOpt('trusted',
               default='goperation-trusted-token',
               help='Trusted token, means a unlimit user'
               ),
    cfg.IntOpt('retries',
               default=3,
               help='Http client retry times, default is 3'
               ),
    cfg.IntOpt('apitimeout',
               default=5,
               help='Http client request timeout, defalut is 5'
               ),
]

index_opts = [
    cfg.IntOpt('page_num',
               default=0,
               help='Bluk select results page number'
               ),
    cfg.StrOpt('order',
               default=None,
Example #3
0
from simpleutil.config import cfg

CONF = cfg.CONF

db_opts = [
    cfg.StrOpt('localroot',
               default='root',
               help='New database intance admin name login from unix socket'),
    cfg.StrOpt(
        'localpass',
        default='gopdb',
        help='New database intance admin password login from unix socket'),
    cfg.IntOpt('affinity',
               default=1,
               min=1,
               max=3,
               help='local database admin password, 1 master, 2 slave, 3 both')
]


def register_opts(group):
    CONF.register_opts(db_opts, group)
Example #4
0
                default=[],
                help='Platforms list enabled'),
]

platform_opts = [
    cfg.BoolOpt('sandbox',
                default=True,
                help='paypal is sandbox api, just for send to paypal sandbox'),
    cfg.FloatOpt(
        'roe',
        default=1.0,
        help=
        'money rate of exchange, do not change this value if you don not what for'
    ),
    cfg.IntOpt('scale', default=100, help='scale for money to coins'),
    cfg.StrOpt('currency', default='USD', help='Pay currency type'),
    cfg.ListOpt('choices',
                default=[],
                item_type=types.Integer(),
                help='Pay money choice')
]


def register_opts(group):
    CONF.register_opts(platforms_opts, group)


def register_platform(name, choices, scale, currency, **kwargs):
    choices = sorted(list(set(choices)))
    base_opt = dict(choices=choices, scale=scale, currency=currency)
    base_opt.update(kwargs)
Example #5
0
from simpleutil.config import cfg
from simpleutil.config.cfg import types

from goperation.config import endpoint_load_opts
from goperation.manager import common as manager_common
from goperation.filemanager.config import filemanager_opts

CONF = cfg.CONF

agent_group = cfg.OptGroup(name=manager_common.AGENT,
                           title='Agent base options group')
CONF.register_group(agent_group)

rpc_agent_opts = [
    cfg.StrOpt('zone',
               default='all',
               regex='^[a-z][a-z0-9]+$',
               help='Agent zone mark'),
    cfg.IntOpt('websokcets',
               default=5,
               min=0,
               max=10,
               help='websocket sub process number'),
    cfg.ListOpt(
        'dnsnames',
        item_type=types.Hostname(),
        default=[],
        help='Agent dns hostnames',
    ),
    cfg.MultiOpt('ports_range',
                 item_type=cfg.types.PortRange(),
                 help='Rpc agent can alloc port from this range'),
Example #6
0
               max=5,
               help='Auto start entity process times when entity dead, '
               '0 means do not auto restart dead entity process'),
    cfg.IntOpt(
        'pop_from_deads',
        default=180,
        min=30,
        max=600,
        help=
        'Entity will remove from auto restart periodic task dead process list after seconds'
    )
]

sources_opts = [
    cfg.StrOpt('source',
               default=None,
               help='databse rw user source privilege limit'),
    cfg.StrOpt('rosource',
               default=None,
               help='databse ro user source privilege limit'),
]

datadb_opts = [
    cfg.StrOpt(
        'datadb_user',
        # regex=REGEXUSER,
        help='data db rw user name'),
    cfg.StrOpt(
        'datadb_passwd',
        # regex=REGEXPASS,
        secret=True,
Example #7
0
from simpleutil.config import cfg

from fluttercomic import common

from fluttercomic.plugin.platforms import config

CONF = cfg.CONF

NAME = 'paypal'


group = cfg.OptGroup(name='%s.%s' % (common.NAME, NAME), title='Fluttercomic Pay platform paypal')

paypal_opts = [
    cfg.StrOpt('clientID',
               help='paypal clientID'),
    cfg.StrOpt('secret',
               secret=True,
               help='paypal secret'),
]


def register_opts(group):
    CONF.register_opts(paypal_opts + config.platform_opts, group)
    config.register_platform(name=NAME,
                             choices=CONF[group.name].choices,
                             scale=CONF[group.name].scale,
                             currency=CONF[group.name].currency)

Example #8
0
from simpleutil.config import cfg

from fluttercomic import common

from fluttercomic.plugin.platforms import config

CONF = cfg.CONF

NAME = 'weixin'


group = cfg.OptGroup(name='%s.%s' % (common.NAME, NAME), title='Fluttercomic WeiXin platform paypal')

weixin_opts = [
    cfg.StrOpt('appId',
               help='WeiXin app Id'),
    cfg.StrOpt('appName',
               help='WeiXin app name'),
    cfg.StrOpt('mchId',
           help='WeiXin mch_id'),
    cfg.StrOpt('secret',
               secret=True,
               help='WeiXin app secret'),
    cfg.StrOpt('package',
               default='Sign=WXPay',
               help='WeiXin package value'),
    cfg.StrOpt('cert',
               default='/etc/goperation/endpoints/wexin_cert.pem',
               help='WeiXin SSL apiclient cert'),
    cfg.StrOpt('key',
               default='/etc/goperation/endpoints/wexin_key.pem',
Example #9
0
CONF = cfg.CONF


goperation_opts = [
    cfg.FloatOpt('glock_alloctime',
                 default=3,
                 help='Timeout for allocate glock'),
    cfg.HostnameOrIPOpt('gcenter',
                        default='127.0.0.1',
                        help='Hostname or IP address of gcenter wsgi service'),
    cfg.PortOpt('gcenter_port',
                default=7999,
                help='Http port of gcenter wsgi service'),
    cfg.StrOpt('trusted',
               # default='goperation-trusted-token',
               help='Trusted token, means a unlimit user, defalut is None'
               ),
]


fernet_opts = [
    cfg.StrOpt('fernet_key_repository',
               help='fernet key dir'),
    cfg.IntOpt('fernet_expire_days',
               default=1, min=1, max=7,
               help='fernet expire max day'),
]


manager_group = cfg.OptGroup(name=common.NAME,
                             title='Manager base options')
Example #10
0
               help='Specify the version of ntp request',
               min=1,
               max=4,
               ),
    cfg.IntOpt('ntp_timeout',
               default=1,
               help='Specify a timeout for ntp request',
               min=1,
               max=5,
               ),
]


server_cli_opts = [
    cfg.StrOpt('state-path',
               default='/var/run/simpleservice',
               help="Where to store simpleservice state files. "
                    "This directory must be writable by the agent. ")
]


def cliopts():
    logging.register_options(CONF)
    CONF.register_cli_opts(server_cli_opts)


def configure(conf=None):
    if conf is None:
        conf = CONF
    conf.register_opts(default_opts)

Example #11
0
from simpleutil.config import cfg

redis_opts = [
    cfg.HostnameOpt('redis_host',
                    default='127.0.0.1',
                    help='Redis connect host address'),
    cfg.PortOpt('redis_port',
                default=6379,
                help='Redis connect Port'),
    cfg.IntOpt('redis_db',
               default=1,
               help='Redis datababse id'),
    cfg.StrOpt('redis_password',
               max_length=32,
               regex='^[a-zA-Z0-9_]+$',
               help='Redis password'),
    cfg.FloatOpt('redis_socket_timeout',
                 default=0.5,
                 help='Timeout for socket send and receive'),
    cfg.FloatOpt('redis_connect_timeout',
                 default=3.0,
                 help='Timeout for socket connect'),
    cfg.IntOpt('redis_pool_size',
               min=2,
               max=20,
               default=3,
               help='Maximum number of redis connections to keep open in a '
                    'pool.'),
    cfg.IntOpt('redis_heartbeat_overtime',
               default=3000,
               max=10000,
Example #12
0
from simpleutil.config import cfg

websocket_opts = [
    cfg.StrOpt('token',
               required=True,
               short='t',
               help='webesocket socket connect token'),
    cfg.StrOpt('home', required=True, help='webesocket home path'),
    cfg.IPOpt('listen',
              default='0.0.0.0',
              short='l',
              help='webesocket listen ip'),
    cfg.PortOpt('port',
                short='p',
                required=True,
                help='webesocket listen port'),
    cfg.BoolOpt('strict', default=True, help='webesocket use strict mode'),
    cfg.IntOpt('heartbeat',
               default=3,
               help='webesocket socket connect and heartbeat timeout'),
]
Example #13
0
endpoint_load_opts = [
    cfg.ListOpt('endpoints',
                item_type=types.String(),
                default=[],
                help='The endpoint group name or namespace'),
]

service_base_opts = [
    cfg.IPOpt('local_ip', version=4, help='Goperation local ip address'),
    cfg.ListOpt('external_ips',
                item_type=cfg.types.IPAddress(version=4),
                default=[],
                help='Goperation external network IP addresses'),
    cfg.FolderPathOpt('work_path', help='Goperation work in this path'),
    cfg.StrOpt('repo', help='Goperation rpm repo address'),
]


def set_all_default():
    # over write state path default value
    from simpleservice.config import server_cli_opts
    cfg.set_defaults(server_cli_opts, state_path='/var/run/goperation')


def set_wsgi_default():
    # set default of paste config
    from simpleservice.wsgi.config import wsgi_server_options
    cfg.set_defaults(wsgi_server_options, paste_config='gcenter-paste.ini')

Example #14
0
from simpleutil.config import cfg

rpc_server_opts = [
    cfg.StrOpt('rpc_user', default='root', help='Rpc Server run user'),
    cfg.StrOpt('rpc_group', default='root', help='Rpc Server run group'),
    cfg.IntOpt(
        'rpc_process',
        default=1,
        min=1,
        max=255,  # snowflake id limit process max number
        help='The number of worker processes to serve the rpc process')
]


def list_opts():
    return rpc_server_opts
Example #15
0
from simpleutil.config import cfg

CONF = cfg.CONF

rabbit_opts = [
    cfg.StrOpt('rabbit_host',
               default='localhost',
               help='The RabbitMQ broker address where a single node is '
               'used.'),
    cfg.PortOpt('rabbit_port',
                default=5672,
                help='The RabbitMQ broker port where a single node is used.'),
    cfg.StrOpt('rabbit_userid', default='guest', help='The RabbitMQ userid.'),
    cfg.StrOpt('rabbit_password',
               default='guest',
               help='The RabbitMQ password.',
               secret=True),
    cfg.StrOpt('rabbit_virtual_host',
               default='simpleservice',
               help='The RabbitMQ virtual host.'),
    cfg.StrOpt('exchange',
               default='simpleservice',
               help='The default exchange under which topics are scoped. May '
               'be overridden by an exchange name specified in the '
               'transport_url option.'),
    cfg.StrOpt('rabbit_login_method',
               default='AMQPLAIN',
               help='The RabbitMQ login method.'),
    cfg.BoolOpt('rabbit_ha_queues',
                default=False,
                help='Try to use HA queues in RabbitMQ (x-ha-policy: all). '
Example #16
0
from simpleutil.config import cfg
from simpleservice.ormdb.config import database_opts

from fluttercomic.plugin.platforms.config import platforms_opts

CONF = cfg.CONF

comic_opts = [
    cfg.StrOpt('basedir',
               default='/data/www/fluttercomic',
               help='Comic file base dir'),
    cfg.MultiOpt('ports_range',
                 item_type=cfg.types.PortRange(),
                 help='Websocket ports range in wsgi server'),
    cfg.StrOpt('user', help='Websocket upload process user'),
    cfg.StrOpt('group', help='Websocket upload process group'),
    cfg.StrOpt('ipaddr', help='Websocket upload ipaddr'),
    cfg.IntOpt('one', default=25, help='One chapter cost coins'),
]


def register_opts(group):
    # database for gopdb
    CONF.register_opts(comic_opts, group)
    CONF.register_opts(database_opts, group)
    CONF.register_opts(platforms_opts, group)
Example #17
0
# import logging
import eventlet
import hashlib

from websockify import websocket

from goperation.websocket import exceptions
from goperation.websocket.base import GopWebSocketServerBase
from goperation.websocket.base import fetch_token

CONF = cfg.CONF


recver_opts = [
    cfg.StrOpt('outfile',
               required=True,
               short='o',
               help='webesocket recver output file'),
    cfg.StrOpt('md5',
               required=True,
               help='file md5 value'),
    cfg.IntOpt('size',
               required=True,
               help='file size'),
    ]


class FileRecvRequestHandler(websocket.WebSocketRequestHandler):

    def __init__(self, req, addr, server):
        self.lastrecv = 0
        if os.path.exists(CONF.outfile):
Example #18
0
from simpleutil.config import cfg

database_init_opts = [
    cfg.StrOpt('user', default='root', help='mysql database root user name'),
    cfg.StrOpt('passwd', default='', help='mysql database root password'),
    cfg.StrOpt('host', default='127.0.0.1', help='mysql host or ipaddress'),
    cfg.PortOpt('port', default=3306, help='mysql server post'),
    cfg.StrOpt('schema', required=True, help='target mysql database schema')
]
Example #19
0
#  not use this file except in compliance with the License. You may obtain
#  a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#  License for the specific language governing permissions and limitations
#  under the License.

from simpleutil.config import cfg

database_opts = [
    cfg.StrOpt('connection',
               help='The SQLAlchemy connection string to use to connect to '
               'the database.',
               secret=True),
    cfg.StrOpt('slave_connection',
               secret=True,
               help='The SQLAlchemy connection string to use to connect to the'
               ' slave database.'),
    cfg.BoolOpt('debug',
                default=False,
                help='Record raw sql to log(set echo of SQLAlchemy to true)'),
    cfg.StrOpt('mysql_sql_mode',
               default='TRADITIONAL',
               help='The SQL mode to be used for MySQL sessions. '
               'This option, including the default, overrides any '
               'server-set SQL mode. To use whatever SQL mode '
               'is set by the server configuration, '
               'set this to no value. Example: mysql_sql_mode='),
Example #20
0
from simpleutil.config import cfg

from fluttercomic import common

from fluttercomic.plugin.platforms import config

CONF = cfg.CONF

NAME = 'ipay'

group = cfg.OptGroup(name='%s.%s' % (common.NAME, NAME),
                     title='Fluttercomic Pay platform ipay')

ipay_opts = [
    cfg.StrOpt('appId', help='ipay appId'),
    cfg.StrOpt('appUid', help='ipay app userid'),
    cfg.IntOpt('waresId', help='ipay waresId'),
    cfg.StrOpt('signtype',
               default='RSA',
               choices=['RSA'],
               help='ipay signtype appId'),
    cfg.StrOpt('rsa_private',
               default='/etc/goperation/endpoints/platforms/ipay_private.key',
               help='ipay signtype rsa private key file'),
    cfg.StrOpt('rsa_public',
               default='/etc/goperation/endpoints/platforms/ipay_public.key',
               help='ipay signtype rsa public key file'),
    cfg.BoolOpt('h5', default=False, help='ipay signtype use h5 api'),
    cfg.UrlOpt('url_r', help='ipay pay with h5 post request url(success)'),
    cfg.UrlOpt('url_h', help='ipay pay with h5 post request url(fail)'),
]