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)
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'), cfg.IntOpt('online_report_interval', default=5, choices=[1, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60], help='Rpc agent online report interval time in minute'),
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, help='Bluk select results order key'
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)'), ]
item_type=types.String(), 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)
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): raise ValueError('output file %s alreday exist' % CONF.outfile) self.timeout = CONF.heartbeat * 3 websocket.WebSocketRequestHandler.__init__(self, req, addr, server) def address_string(self): """
import re import copy from simpleutil.config import cfg from gogamechen1 import common CONF = cfg.CONF REGEXUSER = re.compile('^%s$' % common.REGEXUSER) REGEXPASS = re.compile('^%s$' % common.REGEXPASS) agent_opts = [ cfg.IntOpt('agent_affinity', choices=[1, 2, 3, 4, 5, 6, 7], default=1, help='agent appcaclition affinity bitwise, ' '[gamesvr:1] [publicsvr:2] [gmsvr:4] ' '[publicsvr&gmsvr:6] ' '[gamesvr&publicsvr&gmsvr:7] and so on'), cfg.IntOpt('periodic_interval', default=3, min=0, max=10, help='Entity process periodic check interval by min'), cfg.IntOpt('auto_restart_times', default=1, min=0, max=5, help='Auto start entity process times when entity dead, ' '0 means do not auto restart dead entity process'), cfg.IntOpt(
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', help='WeiXin SSL apiclient key'), cfg.IntOpt('overtime', min=60, max=7200, default=300, help='WeiXin Order overtime, by seconds'), ] def register_opts(group): CONF.register_opts(weixin_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, appId=CONF[group.name].appId, partnerId=CONF[group.name].mchId, package=CONF[group.name].package, )
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') CONF.register_group(manager_group) # goperation opts for manager CONF.register_opts(goperation_opts, manager_group) # database for manager CONF.register_opts(database_opts, manager_group) # redis for manager CONF.register_opts(redis_opts, manager_group) manager_conf = CONF[manager_group.name]
cfg.HostnameOpt('host', default=socket.gethostname(), help="Hostname to be used by the server, agents and " "services running on this machine. All the agents and " "services running on this machine must use the same " "host value."), cfg.BoolOpt('log_options', default=True, help='Enables or disables logging values of all registered ' 'options when starting a service (at DEBUG level).'), ] service_opts = [ cfg.IntOpt('graceful_shutdown_timeout', default=60, help='Specify a timeout after which a gracefully shutdown ' 'server will exit. Zero value means endless wait.') ] ntp_opts = [ cfg.IPOpt('ntp_server', help='Specify server ip address of ntp request' ), cfg.PortOpt('ntp_port', default=123, help='Specify port of ntp request' ), cfg.IntOpt('ntp_version', default=4, help='Specify the version of ntp request',
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,
from simpleutil.utils import systemutils from simpleutil.utils import jsonutils from simpleutil.utils.tailutils import TailWithF from simpleutil.utils.threadgroup import ThreadGroup from goperation.websocket import exceptions from goperation.websocket.base import GopWebSocketServerBase from goperation.websocket.base import fetch_token CONF = cfg.CONF reader_opts = [ cfg.IntOpt('lines', short='n', default=10, min=1, help='output the last n lines, instead of the last 10'), ] class FileSendRequestHandler(websocket.WebSocketRequestHandler): def __init__(self, req, addr, server): self.lastsend = 0 self.timeout = CONF.heartbeat * 3 websocket.WebSocketRequestHandler.__init__(self, req, addr, server) def address_string(self): """ f**k gethostbyaddr!!!!! f**k gethostbyaddr on logging!!!
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'), ]
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
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.'),
from simpleutil.config import cfg from simpleutil.config import types CONF = cfg.CONF gop_rpc_server_opts = [ cfg.IntOpt('expire_time', min=2, max=20, default=10, help='Rpc agent status expire time'), cfg.ListOpt('executers', item_type=types.String(), default=['http'], help='Rpc server executer class list'), cfg.ListOpt('conditions', item_type=types.String(), default=['agents', 'entitys'], help='Rpc server conditions class list'), ] def list_opts(): return gop_rpc_server_opts
help='Try to use HA queues in RabbitMQ (x-ha-policy: all). ' 'If you change this option, you must wipe the RabbitMQ ' 'database. In RabbitMQ 3.0, queue mirroring is no longer ' 'controlled by the x-ha-policy argument when declaring a ' 'queue. If you just want to make sure that all queues (except ' ' those with auto-generated names) are mirrored across all ' 'nodes, run: ' """\"rabbitmqctl set_policy HA '^(?!amq\.).*' """ """'{"ha-mode": "all"}' \""""), cfg.FloatOpt('kombu_reconnect_delay', default=0.5, help='How long to wait before reconnecting in response to an ' 'AMQP consumer cancel notification.'), cfg.IntOpt('kombu_missing_consumer_retry_timeout', default=5, help='How long to wait a missing client beforce abandoning to ' 'send it its replies. This value should not be longer ' 'than rpc_send_timeout.'), cfg.StrOpt('kombu_failover_strategy', choices=('round-robin', 'shuffle'), default='round-robin', help='Determines how the next RabbitMQ node is chosen in case ' 'the one we are currently connected to becomes ' 'unavailable. Takes effect only if more than one ' 'RabbitMQ node is provided in config.'), cfg.IntOpt('rabbit_retry_interval', default=1, help='How frequently to retry connecting with RabbitMQ.'), cfg.IntOpt('rabbit_retry_backoff', default=1, help='How long to backoff for between retries when connecting '
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)
from simpleutil.config import cfg from simpleservice.ormdb.config import database_opts CONF = cfg.CONF resource_opts = [ cfg.IntOpt('objfile_resource', default=0, help='Gopcdn resource for objfile'), cfg.IntOpt('package_resource', default=0, help='Gopcdn resource for packages files'), ] def register_opts(group): # database for gopdb CONF.register_opts(database_opts, group) CONF.register_opts(resource_opts, group)
from simpleutil.config import cfg CONF = cfg.CONF mysql_db_opts = [ cfg.IntOpt('expire_log_days', min=1, max=14, default=3, help='mysql bin log expire days'), ] def register_opts(group): CONF.register_opts(mysql_db_opts, group)
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='), cfg.IntOpt('idle_timeout', default=600, help='Timeout before idle SQL connections are reaped.'), cfg.IntOpt('min_pool_size', default=1, help='Minimum number of SQL connections to keep open in a ' 'pool.'), cfg.IntOpt('max_pool_size', default=5, help='Maximum number of SQL connections to keep open in a ' 'pool.'), cfg.IntOpt('max_retries', default=10, help='Maximum number of database connection retries ' 'during startup. Set to -1 to specify an infinite ' 'retry count.'), cfg.IntOpt('retry_interval',
cors_opts = [ cfg.ListOpt('allowed_origin', default=["*"], help='Indicate whether this resource may be shared with the ' 'domain received in the requests "origin" header.'), cfg.BoolOpt('allow_credentials', default=True, help='Indicate that the actual request can include user ' 'credentials'), cfg.ListOpt('expose_headers', default=['Content-Type', 'Cache-Control', 'Content-Language', 'Expires', 'Last-Modified', 'Pragma'], help='Indicate which headers are safe to expose to the API. ' 'Defaults to HTTP Simple Headers.'), cfg.IntOpt('max_age', default=3600, help='Maximum cache age of CORS preflight requests.'), cfg.ListOpt('allow_methods', default=['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'UPDATE', 'HEAD'], help='Indicate which methods can be used during the actual ' 'request.'), cfg.ListOpt('allow_headers', default=['Content-Type', 'Cache-Control', 'Content-Language', 'Expires', 'Last-Modified', 'Pragma', 'Auth-Token', 'X-Real-IP', 'gopfernet'], help='Indicate which header field names may be used during ' 'the actual request.') ] def list_opts():