mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-04-05 20:17:53 +08:00
feat:配置信息可以从环境变量中读取
This commit is contained in:
parent
87d2047e30
commit
09d4db61b0
@ -1,34 +1,47 @@
|
||||
appname = mindoc
|
||||
# httpaddr = 127.0.0.1
|
||||
httpport = 8181
|
||||
runmode = dev
|
||||
|
||||
#默认监听的网卡,为空则监听所有
|
||||
httpaddr="${MINDOC_ADDR}"
|
||||
httpport = "${MINDOC_PORT||8181}"
|
||||
runmode = "${MINDOC_RUN_MODE||dev}"
|
||||
sessionon = true
|
||||
sessionname = mindoc_id
|
||||
copyrequestbody = true
|
||||
|
||||
#系统完整URL(http://doc.iminho.me),如果该项不设置,会从请求头中获取地址。
|
||||
baseurl=
|
||||
#默认Session生成Key的秘钥
|
||||
beegoserversessionkey=123456
|
||||
baseurl="${MINDOC_BASE_URL}"
|
||||
|
||||
|
||||
#########代码高亮样式################
|
||||
#样式演示地址:https://highlightjs.org/static/demo/
|
||||
highlight_style=github
|
||||
highlight_style="${MINDOC_HIGHLIGHT_STYLE||github}"
|
||||
|
||||
########配置文件自动加载##################
|
||||
#大于0时系统会自动检测配置文件是否变动,变动后自动加载并生效,单位是秒。监听端口和数据库配置无效
|
||||
config_auto_delay=0
|
||||
config_auto_delay="${MINDOC_CONFIG_AUTO_DELAY||20}"
|
||||
|
||||
|
||||
########Session储存方式##############
|
||||
|
||||
#默认Session生成Key的秘钥
|
||||
beegoserversessionkey="${MINDOC_SESSION_KEY||NY1B$28pms12JM&c}"
|
||||
sessionprovider="${MINDOC_SESSION_PROVIDER||file}"
|
||||
sessionproviderconfig="${MINDOC_SESSION_PROVIDER_CONFIG||./runtime/session}"
|
||||
#默认的过期时间
|
||||
sessiongcmaxlifetime="${MINDOC_SESSION_MAX_LIFETIME||3600}"
|
||||
|
||||
#以文件方式储存
|
||||
sessionprovider=file
|
||||
sessionproviderconfig=./runtime/session
|
||||
#sessionprovider=file
|
||||
#sessionproviderconfig=./runtime/session
|
||||
|
||||
#以redis方式储存
|
||||
#sessionprovider=redis
|
||||
#sessionproviderconfig=127.0.0.1:6379
|
||||
|
||||
#以memcache方式储存
|
||||
#sessionprovider=memcache
|
||||
#sessionproviderconfig=127.0.0.1:11211
|
||||
|
||||
#以内存方式托管Session
|
||||
#sessionprovider=memory
|
||||
|
||||
@ -39,12 +52,12 @@ timezone = Asia/Shanghai
|
||||
|
||||
####################MySQL 数据库配置###########################
|
||||
#支持MySQL和sqlite3两种数据库,如果是sqlite3 则 db_database 标识数据库的物理目录
|
||||
db_adapter=mysql
|
||||
db_host=127.0.0.1
|
||||
db_port=3306
|
||||
db_database=mindoc_db
|
||||
db_username=root
|
||||
db_password=123456
|
||||
db_adapter="${MINDOC_DB_ADAPTER||mysql}"
|
||||
db_host="${MINDOC_DB_HOST||127.0.0.1}"
|
||||
db_port="${MINDOC_DB_PORT||3306}"
|
||||
db_database="${MINDOC_DB_DATABASE||mindoc_db}"
|
||||
db_username="${MINDOC_DB_USERNAME||root}"
|
||||
db_password="${MINDOC_DB_PASSWORD||123456}"
|
||||
|
||||
####################sqlite3 数据库配置###########################
|
||||
#db_adapter=sqlite3
|
||||
@ -61,42 +74,43 @@ token_size=12
|
||||
|
||||
#上传文件的后缀,如果不限制后缀可以设置为 *
|
||||
upload_file_ext=txt|doc|docx|xls|xlsx|ppt|pptx|pdf|7z|rar|jpg|jpeg|png|gif
|
||||
|
||||
#上传的文件大小限制,如果不填写,默认不限制,单位可以是 GB KB MB
|
||||
upload_file_size=10MB
|
||||
|
||||
####################邮件配置######################
|
||||
#是否启用邮件
|
||||
enable_mail=false
|
||||
enable_mail="${MINDOC_ENABLE_MAIL||false}"
|
||||
#每小时限制指定邮箱邮件发送次数
|
||||
mail_number=5
|
||||
mail_number="${MINDOC_MAIL_NUMBER||5}"
|
||||
#smtp服务用户名
|
||||
smtp_user_name=admin@iminho.me
|
||||
smtp_user_name="${MINDOC_SMTP_USER_NAME||admin@iminho.me}"
|
||||
#smtp服务器地址
|
||||
smtp_host=smtp.163.com
|
||||
smtp_host="${MINDOC_SMTP_HOST||smtp.163.com}""
|
||||
#smtp密码
|
||||
smtp_password=
|
||||
smtp_password="${MINDOC_SMTP_PASSWORD}"
|
||||
#端口号
|
||||
smtp_port=25
|
||||
smtp_port="${MINDOC_SMTP_PORT||25}""
|
||||
#发送邮件的显示名称
|
||||
form_user_name=admin@iminho.me
|
||||
form_user_name="${MINDOC_FORM_USERNAME||admin@iminho.me}"
|
||||
#邮件有效期30分钟
|
||||
mail_expired=30
|
||||
mail_expired="${MINDOC_EXPIRED||30}"
|
||||
#加密类型NONE 无认证、SSL 加密、LOGIN 普通用户登录
|
||||
secure=LOGIN
|
||||
secure="${MINDOC_MAIL_SECURE||LOGIN}"
|
||||
|
||||
###############配置导出项目###################
|
||||
enable_export=true
|
||||
enable_export="${MINDOC_ENABLE_EXPORT||false}"
|
||||
#同一个项目同时运行导出程序的并行数量,取值1-4之间,取值越大导出速度越快,越占用资源
|
||||
export_process_num=1
|
||||
export_process_num="${MINDOC_EXPORT_PROCESS_NUM||1}"
|
||||
|
||||
#并发导出的项目限制,指同一时间限制的导出项目数量,如果为0则不限制。设置的越大,越占用资源
|
||||
export_limit_num=1
|
||||
export_limit_num="${MINDOC_EXPORT_LIMIT_NUM||5}"
|
||||
|
||||
#指同时等待导出的任务数量
|
||||
export_queue_limit_num=100
|
||||
export_queue_limit_num="${MINDOC_EXPORT_QUEUE_LIMIT_NUM||100}"
|
||||
|
||||
#导出项目的缓存目录配置
|
||||
export_output_path=./runtime/cache
|
||||
export_output_path="${MINDOC_EXPORT_OUTPUT_PATH||./runtime/cache}"
|
||||
|
||||
################百度地图密钥#################
|
||||
baidumapkey=
|
||||
@ -122,72 +136,72 @@ ldap_user_role=2
|
||||
ldap_filter=objectClass=posixAccount
|
||||
|
||||
###############配置CDN加速##################
|
||||
cdn=
|
||||
cdnjs=
|
||||
cdncss=
|
||||
cdnimg=
|
||||
cdn="${MINDOC_CDN_URL}"
|
||||
cdnjs="${MINDOC_CDN_JS_URL}"
|
||||
cdncss="${MINDOC_CDN_CSS_URL}"
|
||||
cdnimg="${MINDOC_CDN_IMG_URL}"
|
||||
|
||||
######################缓存配置###############################
|
||||
|
||||
#是否开启缓存,true 开启/false 不开启
|
||||
cache=false
|
||||
cache="${MINDOC_CACHE||false}"
|
||||
|
||||
#缓存方式:memory/memcache/redis/file
|
||||
cache_provider=memory
|
||||
cache_provider="${MINDOC_CACHE_PROVIDER||memory}"
|
||||
|
||||
#当配置缓存方式为memory时,内存回收时间,单位是秒
|
||||
cache_memory_interval=120
|
||||
cache_memory_interval="${MINDOC_CACHE_MEMORY_INTERVAL||120}"
|
||||
|
||||
#当缓存方式配置为file时,缓存的储存目录
|
||||
cache_file_path=./runtime/cache/
|
||||
cache_file_path="${MINDOC_CACHE_FILE_PATH||./runtime/cache/}"
|
||||
|
||||
#缓存文件后缀
|
||||
cache_file_suffix=.bin
|
||||
cache_file_suffix="${MINDOC_CACHE_FILE_SUFFIX||.bin}"
|
||||
|
||||
#文件缓存目录层级
|
||||
cache_file_dir_level=2
|
||||
cache_file_dir_level="${MINDOC_CACHE_FILE_DIR_LEVEL||2}"
|
||||
|
||||
#文件缓存的默认过期时间
|
||||
cache_file_expiry=3600
|
||||
cache_file_expiry="${MINDOC_CACHE_FILE_EXPIRY||3600}"
|
||||
|
||||
#memcache缓存服务器地址
|
||||
cache_memcache_host=127.0.0.1:11211
|
||||
cache_memcache_host="${MINDOC_CACHE_MEMCACHE_HOST||127.0.0.1:11211}"
|
||||
|
||||
#redis服务器地址
|
||||
cache_redis_host=127.0.0.1:6379
|
||||
cache_redis_host="${MINDOC_CACHE_REDIS_HOST||127.0.0.1:6379}"
|
||||
|
||||
#redis数据库索引
|
||||
cache_redis_db=0
|
||||
cache_redis_db="${MINDOC_CACHE_REDIS_DB||0}"
|
||||
|
||||
#redis服务器密码
|
||||
cache_redis_password=
|
||||
cache_redis_password="${MINDOC_CACHE_REDIS_PASSWORD}"
|
||||
|
||||
#缓存键的前缀
|
||||
cache_redis_prefix=mindoc::cache
|
||||
cache_redis_prefix="${MINDOC_CACHE_REDIS_PREFIX||mindoc::cache}"
|
||||
|
||||
|
||||
#########日志储存配置##############
|
||||
|
||||
#日志保存路径,在linux上,自动创建的日志文件请不要删除,否则将无法写入日志
|
||||
log_path=./runtime/logs
|
||||
log_path="${MINDOC_LOG_PATH||./runtime/logs}"
|
||||
|
||||
#每个文件保存的最大行数,默认值 1000000
|
||||
log_maxlines=1000000
|
||||
log_maxlines="${MINDOC_LOG_MAX_LINES||1000000}"
|
||||
|
||||
# 每个文件保存的最大尺寸,默认值是 1 << 28, //256 MB
|
||||
log_maxsize=
|
||||
log_maxsize="${MINDOC_LOG_MAX_SIZE}"
|
||||
|
||||
# 是否按照每天 logrotate,默认是 true
|
||||
log_daily=true
|
||||
log_daily="${MINDOC_LOG_DAILY||true}"
|
||||
|
||||
# 文件最多保存多少天,默认保存 7 天
|
||||
log_maxdays=30
|
||||
log_maxdays="${MINDOC_LOG_MAX_DAYS||30}"
|
||||
|
||||
# 日志保存的时候的级别,默认是 Trace 级别,可选值: Emergency/Alert/Critical/Error/Warning/Notice/Informational/Debug/Trace
|
||||
log_level=Trace
|
||||
log_level="${MINDOC_LOG_LEVEL||Trace}"
|
||||
|
||||
# 是否异步生成日志,默认是 true
|
||||
log_is_async=true
|
||||
log_is_async="${MINDOC_LOG_IS_ASYNC||TRUE}"
|
||||
|
||||
|
||||
|
||||
|
77
start.sh
77
start.sh
@ -9,83 +9,6 @@ if [ ! -f "/mindoc/conf/app.conf" ] ; then
|
||||
sed -i "s#^db_database.*#db_database=./database/mindoc.db#g" conf/app.conf
|
||||
fi
|
||||
|
||||
if [ ! -z $DB_ADAPTER ]; then
|
||||
sed -i "s#^db_adapter=.*#db_adapter=${DB_ADAPTER}#g" conf/app.conf
|
||||
fi
|
||||
|
||||
if [ ! -z $MYSQL_PORT_3306_TCP_ADDR ] ; then
|
||||
sed -i 's/^db_host.*/db_host='$MYSQL_PORT_3306_TCP_ADDR'/g' conf/app.conf
|
||||
fi
|
||||
|
||||
if [ ! -z $MYSQL_PORT_3306_TCP_PORT ] ; then
|
||||
sed -i 's/^db_port.*/db_port='$MYSQL_PORT_3306_TCP_PORT'/g' conf/app.conf
|
||||
fi
|
||||
|
||||
if [ ! -z $MYSQL_INSTANCE_NAME ] ; then
|
||||
sed -i "s#^db_database.*#db_database=${MYSQL_INSTANCE_NAME}#g" conf/app.conf
|
||||
fi
|
||||
|
||||
if [ ! -z $MYSQL_USERNAME ] ; then
|
||||
sed -i 's/^db_username.*/db_username='$MYSQL_USERNAME'/g' conf/app.conf
|
||||
fi
|
||||
|
||||
if [ ! -z $MYSQL_PASSWORD ] ; then
|
||||
sed -i 's/^db_password.*/db_password='$MYSQL_PASSWORD'/g' conf/app.conf
|
||||
fi
|
||||
|
||||
if [ ! -z $HTTP_PORT ] ; then
|
||||
sed -i 's/^httpport.*/httpport='$HTTP_PORT'/g' conf/app.conf
|
||||
fi
|
||||
|
||||
if [ ! -z $CDNJS ]; then
|
||||
sed -i "s#^cdnjs=.*#cdnjs=$CDNJS#g" conf/app.conf
|
||||
fi
|
||||
if [ ! -z $CDNIMG ]; then
|
||||
sed -i "s#^cdnimg=.*#cdnimg=$CDNIMG#g" conf/app.conf
|
||||
fi
|
||||
|
||||
if [ ! -z $CDNCSS ]; then
|
||||
sed -i "s#^cdncss=.*#cdncss=$CDNCSS#g" conf/app.conf
|
||||
fi
|
||||
|
||||
if [ ! -z $CDN ]; then
|
||||
sed -i "s#^cdn=.*#cdn=$CDN#g" conf/app.conf
|
||||
fi
|
||||
|
||||
if [ ! -z $CACHE ]; then
|
||||
sed -i "s#cache=.*#cache=$CACHE#g" conf/app.conf
|
||||
fi
|
||||
|
||||
if [ ! -z $CACHE_PROVIDER ]; then
|
||||
sed -i "s#cache_provider=.*#cache_provider=$CACHE_PROVIDER#g" conf/app.conf
|
||||
fi
|
||||
|
||||
if [ ! -z $CACHE_MEMCACHE_HOST ]; then
|
||||
sed -i "s#cache_memcache_host=.*#cache_memcache_host=$CACHE_MEMCACHE_HOST#g" conf/app.conf
|
||||
fi
|
||||
|
||||
if [ ! -z $CACHE_REDIS_HOST ]; then
|
||||
sed -i "s#cache_redis_host=.*#cache_redis_host=$CACHE_REDIS_HOST#g" conf/app.conf
|
||||
fi
|
||||
|
||||
if [ ! -z $CACHE_REDIS_DB ]; then
|
||||
sed -i "s#cache_redis_db=.*#cache_redis_db=$CACHE_REDIS_DB#g" conf/app.conf
|
||||
fi
|
||||
|
||||
if [ ! -z $CACHE_REDIS_PASSWROD ]; then
|
||||
sed -i "s#cache_redis_password=.*#cache_redis_password=$CACHE_REDIS_PASSWROD#g" conf/app.conf
|
||||
fi
|
||||
|
||||
if [ ! -z $BASEURL ]; then
|
||||
sed -i "s#baseurl=.*#baseurl=$BASEURL#g" conf/app.conf
|
||||
fi
|
||||
|
||||
if [ ! -z $ENABLE_EXPORT ]; then
|
||||
sed -i "s#enable_export=.*#enable_export=$ENABLE_EXPORT#g" conf/app.conf
|
||||
fi
|
||||
|
||||
|
||||
sed -i 's/^runmode.*/runmode=prod/g' conf/app.conf
|
||||
|
||||
/mindoc/mindoc_linux_amd64 install
|
||||
/mindoc/mindoc_linux_amd64
|
Loading…
Reference in New Issue
Block a user