Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge Develop update version to v0.5.7-beta #67

Merged
merged 5 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/mdbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
push:
branches:
- master
pull_request:
workflow_dispatch:

jobs:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rnacos"
version = "0.5.6"
version = "0.5.7-beta"
authors = ["heqingpan <[email protected]>"]
edition = "2018"
license = "Apache-2.0"
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ r-nacos设计上完全兼容最新版本nacos面向client sdk 的协议(包含

r-nacos相较于java nacos来说,是一个提供相同功能,启动更快、占用系统资源更小、性能更高、运行更稳定的服务。

详细说明可以看 [r-nacos book](https://r-nacos.github.io/docs/)
详细说明可以看 [r-nacos docs](https://r-nacos.github.io/docs/)

## 适用场景

Expand Down Expand Up @@ -139,6 +139,7 @@ rnacos
|RUST_LOG|日志等级:debug,info,warn,error;所有http,grpc请求都会打info日志,如果不观注可以设置为error减少日志量|info|error|0.3.0|
|RNACOS_ENABLE_NO_AUTH_CONSOLE|是否开启无鉴权控制台|false|false|0.5.2|
|RNACOS_CONSOLE_LOGIN_TIMEOUT|控制台登陆有效时长(单位为秒)|一天,86400秒|86400|0.5.0|
|RNACOS_GMT_OFFSET_HOURS|日志时间的时区,单位小时;默认为本机时区,运行在docker时需要指定|local|8(东8区),-5(西5区)|0.5.7|


启动配置方式可以参考: [运行参数说明](https://r-nacos.github.io/docs/notes/env_config/)
Expand Down
1 change: 1 addition & 0 deletions book/src/deplay_env.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ rnacos 运行时支持的环境变量,如果不设置则按默认配置运行
|RUST_LOG|日志等级:debug,info,warn,error;所有http,grpc请求都会打info日志,如果不观注可以设置为error减少日志量|info|error|0.3.0|
|RNACOS_ENABLE_NO_AUTH_CONSOLE|是否开启无鉴权控制台|false|false|0.5.2|
|RNACOS_CONSOLE_LOGIN_TIMEOUT|控制台登陆有效时长(单位为秒)|一天,86400秒|86400|0.5.0|
|RNACOS_GMT_OFFSET_HOURS|日志时间的时区,单位小时;默认为本机时区,运行在docker时需要指定|local|8(东8区),-5(西5区)|0.5.7|


注:从v0.3.0开始,默认参数启动的节点会被当做只有一个节点,当前节点是主节点的集群部署。支持其它新增的从节点加入。
Expand Down
2 changes: 2 additions & 0 deletions doc/conf/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@ RNACOS_ENABLE_NO_AUTH_CONSOLE=false
# 控制台登陆有效时长(单位为秒),默认86400秒(一天)
#RNACOS_CONSOLE_LOGIN_TIMEOUT=86400

# 日志时间的时区,单位小时;默认为本机时区,运行在docker时需要指定; 示例: 8(东8区),-5(西5区)
#RNACOS_GMT_OFFSET_HOURS=8
2 changes: 1 addition & 1 deletion src/common/constant.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::sync::Arc;

pub const APP_VERSION: &str = "0.5.6";
pub const APP_VERSION: &str = "0.5.7-beta";

pub const EMPTY_STR: &str = "";

Expand Down
6 changes: 6 additions & 0 deletions src/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ pub struct AppSysConfig {
pub raft_snapshot_log_size: u64,
pub console_login_timeout: i32,
pub console_login_one_hour_limit: u32,
pub gmt_fixed_offset_hours: Option<i32>,
}

impl AppSysConfig {
Expand Down Expand Up @@ -120,6 +121,10 @@ impl AppSysConfig {
.unwrap_or("false".to_owned())
.parse()
.unwrap_or(false);
let gmt_fixed_offset_hours = std::env::var("RNACOS_GMT_OFFSET_HOURS")
.unwrap_or_default()
.parse()
.ok();
Self {
config_db_dir,
config_db_file,
Expand All @@ -136,6 +141,7 @@ impl AppSysConfig {
raft_snapshot_log_size,
console_login_timeout,
console_login_one_hour_limit,
gmt_fixed_offset_hours,
}
}

Expand Down
7 changes: 5 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,14 @@ async fn main() -> Result<(), Box<dyn Error>> {
let rust_log = std::env::var("RUST_LOG").unwrap_or("info".to_owned());
println!("version:{}, RUST_LOG:{}", APP_VERSION, &rust_log);
std::env::set_var("RUST_LOG", &rust_log);
let timezone_fmt = Arc::new(TimeZoneFormatEnv::new(Some(8*60*60),Some(TimestampPrecision::Micros)));
let sys_config = Arc::new(AppSysConfig::init_from_env());
let timezone_fmt = Arc::new(TimeZoneFormatEnv::new(
sys_config.gmt_fixed_offset_hours.map(|v| v * 60 * 60),
Some(TimestampPrecision::Micros),
));
env_logger::Builder::from_default_env()
.format(move |buf, record| TimeZoneFormat::new(buf, &timezone_fmt).write(record))
.init();
let sys_config = Arc::new(AppSysConfig::init_from_env());
let factory_data = config_factory(sys_config.clone()).await?;
let app_data = build_share_data(factory_data.clone())?;
let http_addr = sys_config.get_http_addr();
Expand Down
Loading