chore: remove cfg_attrs for napi, which are no longer needed

This commit is contained in:
naskya 2024-01-27 07:09:28 +09:00
parent fe051e8207
commit 9cc05e565b
Signed by: naskya
GPG key ID: 712D413B3A9FED5C
2 changed files with 7 additions and 7 deletions

View file

@ -1,4 +1,4 @@
#[cfg_attr(feature = "napi", napi_derive::napi)]
#[napi_derive::napi]
pub struct EnvConfig {
pub only_queue: bool,
pub only_server: bool,
@ -10,7 +10,7 @@ pub struct EnvConfig {
pub slow: bool,
}
#[cfg_attr(feature = "napi", napi_derive::napi)]
#[napi_derive::napi]
pub fn read_environment_config() -> EnvConfig {
let node_env = std::env::var("NODE_ENV").unwrap_or_default().to_lowercase();
let is_testing = node_env == "test" || node_env == "testing";

View file

@ -5,7 +5,7 @@ use std::fs;
#[derive(Debug, PartialEq, Deserialize)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "napi", napi_derive::napi(object))]
#[napi_derive::napi(object)]
pub struct ServerConfig {
pub url: String,
pub db: DbConfig,
@ -14,7 +14,7 @@ pub struct ServerConfig {
}
#[derive(Debug, PartialEq, Deserialize)]
#[cfg_attr(feature = "napi", napi_derive::napi(object))]
#[napi_derive::napi(object)]
pub struct DbConfig {
pub host: String,
pub port: u32,
@ -24,7 +24,7 @@ pub struct DbConfig {
}
#[derive(Debug, PartialEq, Deserialize)]
#[cfg_attr(feature = "napi", napi_derive::napi(object))]
#[napi_derive::napi(object)]
pub struct RedisConfig {
pub host: String,
pub port: u32,
@ -39,13 +39,13 @@ pub struct RedisConfig {
#[derive(Debug, PartialEq, Deserialize)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "napi", napi_derive::napi(object))]
#[napi_derive::napi(object)]
pub struct TlsConfig {
pub host: String,
pub reject_unauthorized: bool,
}
#[cfg_attr(feature = "napi", napi_derive::napi)]
#[napi_derive::napi]
pub fn read_server_config() -> ServerConfig {
let cwd = env::current_dir().unwrap();
let yml = fs::File::open(cwd.join("../../.config/default.yml"))