1 Star 0 Fork 54

龍dz/codo-dns

forked from opendevops/codo-dns 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
settings.py 5.04 KB
一键复制 编辑 原始数据 按行查看 历史
ss1917 提交于 2020-04-04 13:05 . 完善了一些云解析
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Author : shenshuo
Date : 2019年5月6日
Desc : 配置文件
"""
import os
from websdk.consts import const
ROOT_DIR = os.path.dirname(__file__)
debug = True
xsrf_cookies = False
expire_seconds = 365 * 24 * 60 * 60
cookie_secret = os.getenv('COOKIE_SECRET', '61oETzKXQAGaYdkL5gEmGeJJFuYh7EQnp2X6TP1o/Vo=')
DEFAULT_DB_DBHOST = os.getenv('DEFAULT_DB_DBHOST', '192.168.1.4')
DEFAULT_DB_DBPORT = os.getenv('DEFAULT_DB_DBPORT', '3306')
DEFAULT_DB_DBUSER = os.getenv('DEFAULT_DB_DBUSER', 'root')
DEFAULT_DB_DBPWD = os.getenv('DEFAULT_DB_DBPWD', 'm9uSFL7duAVXfeAwGUSG')
DEFAULT_DB_DBNAME = os.getenv('DNS_DB_DBNAME', 'codo_dns')
READONLY_DB_DBHOST = os.getenv('READONLY_DB_DBHOST', '192.168.1.4')
READONLY_DB_DBPORT = os.getenv('READONLY_DB_DBPORT', '3306')
READONLY_DB_DBUSER = os.getenv('READONLY_DB_DBUSER', 'root')
READONLY_DB_DBPWD = os.getenv('READONLY_DB_DBPWD', 'm9uSFL7duAVXfeAwGUSG')
READONLY_DB_DBNAME = os.getenv('DNS_DB_DBNAME', 'codo_dns')
DEFAULT_REDIS_HOST = os.getenv('DEFAULT_REDIS_HOST', '192.168.1.4')
DEFAULT_REDIS_PORT = os.getenv('DEFAULT_REDIS_PORT', '6379')
DEFAULT_REDIS_DB = 8
DEFAULT_REDIS_AUTH = True
DEFAULT_REDIS_CHARSET = 'utf-8'
DEFAULT_REDIS_PASSWORD = os.getenv('DEFAULT_REDIS_PASSWORD', 'cWCVKJ7ZHUK12mVbivUf')
named_init_conf = """
options {
//listen-on port 53 { 127.0.0.1; };
//listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
//allow-query { localhost; };
recursion yes;
dnssec-enable no;
dnssec-validation no;
dnssec-lookaside auto;
allow-query-cache { any; };
allow-query { any; };
/* Path to ISC DLV key */
//bindkeys-file "/etc/named.iscdlv.key";
//managed-keys-directory "/var/named/dynamic";
};
//----------------------------------------
//-------------- smart DNS ---------------
//----------------------------------------
//------------------ NW -------------------
include "/etc/named.neiwang.conf";
view "View_NW" {
match-clients { NW; };
//example_neiwang
/* zone "example.com" IN {
type master;
file "example.com-neiwang.zone";
allow-update { none; };
}; */
};
//----------------- CU -------------------
include "/etc/named.liantong.conf";
view "View_CU" {
match-clients { CU; };
//example_liantong
/* zone "example.com" IN {
type master;
file "example.com-liantong.zone";
allow-update { none; };
}; */
};
//----------------- CT -------------------
include "/etc/named.dianxin.conf";
view "View_CT" {
match-clients { CT; };
//example_dianxin
/* zone "example.com" IN {
type master;
file "example.com-dianxin.zone";
allow-update { none; };
}; */
};
//---------------- CERNET ----------------
include "/etc/named.jiaoyu.conf";
view "View_CERNET" {
match-clients { CERNET; };
//example_jiaoyu
/* zone "example.com" IN {
type master;
file "example.com-jiaoyu.zone";
allow-update { none; };
}; */
};
//---------------- ANY ----------------
view "View_ANY" {
match-clients { any; };
//example_any
/* zone "example.com" IN {
type master;
file "example.com.zone";
allow-update { none; };
}; */
};
"""
# region_init_conf = dict(any='默认', neiwang='内网', dianxin='电信', liantong='联通', jiaoyu='教育', guonei='国内',
# huadong='华东', huazhong='华中', huanan='华南', huabei='华北', dongbei='东北', xibei='西北',
# xinan='西南')
region_init_conf = dict(默认='any', 内网='neiwang', 电信='dianxin', 联通='liantong', 教育='jiaoyu')
try:
from local_settings import *
except:
pass
settings = dict(
debug=debug,
xsrf_cookies=xsrf_cookies,
cookie_secret=cookie_secret,
expire_seconds=expire_seconds,
app_name='codo-dns',
named_init_conf=named_init_conf,
region_init_conf=region_init_conf,
databases={
const.DEFAULT_DB_KEY: {
const.DBHOST_KEY: DEFAULT_DB_DBHOST,
const.DBPORT_KEY: DEFAULT_DB_DBPORT,
const.DBUSER_KEY: DEFAULT_DB_DBUSER,
const.DBPWD_KEY: DEFAULT_DB_DBPWD,
const.DBNAME_KEY: DEFAULT_DB_DBNAME,
},
const.READONLY_DB_KEY: {
const.DBHOST_KEY: READONLY_DB_DBHOST,
const.DBPORT_KEY: READONLY_DB_DBPORT,
const.DBUSER_KEY: READONLY_DB_DBUSER,
const.DBPWD_KEY: READONLY_DB_DBPWD,
const.DBNAME_KEY: READONLY_DB_DBNAME,
}
},
redises={
const.DEFAULT_RD_KEY: {
const.RD_HOST_KEY: DEFAULT_REDIS_HOST,
const.RD_PORT_KEY: DEFAULT_REDIS_PORT,
const.RD_DB_KEY: DEFAULT_REDIS_DB,
const.RD_AUTH_KEY: DEFAULT_REDIS_AUTH,
const.RD_CHARSET_KEY: DEFAULT_REDIS_CHARSET,
const.RD_PASSWORD_KEY: DEFAULT_REDIS_PASSWORD
}
}
)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/longdaozhang/codo-dns.git
[email protected]:longdaozhang/codo-dns.git
longdaozhang
codo-dns
codo-dns
master

搜索帮助