mirror of
https://example.com
synced 2024-11-22 11:26:38 +09:00
chore: remove cfg_attr
s for napi, which are no longer needed
This commit is contained in:
parent
fe051e8207
commit
9cc05e565b
2 changed files with 7 additions and 7 deletions
|
@ -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";
|
||||
|
|
|
@ -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"))
|
||||
|
|
Loading…
Reference in a new issue