♻️ Ajustes menores
This commit is contained in:
parent
da8604980d
commit
46d4e19c39
6 changed files with 6 additions and 15 deletions
|
|
@ -5,7 +5,6 @@ use crate::config;
|
||||||
|
|
||||||
use substring::Substring;
|
use substring::Substring;
|
||||||
|
|
||||||
|
|
||||||
pub fn print_on_startup() {
|
pub fn print_on_startup() {
|
||||||
if config::SETTINGS.app.startup_banner.to_lowercase() != "off" {
|
if config::SETTINGS.app.startup_banner.to_lowercase() != "off" {
|
||||||
if let Some((term_width, _)) = term_size::dimensions() {
|
if let Some((term_width, _)) = term_size::dimensions() {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ use crate::db::*;
|
||||||
use sea_orm::{ConnectOptions, ConnectionTrait, Database, DatabaseBackend, Statement};
|
use sea_orm::{ConnectOptions, ConnectionTrait, Database, DatabaseBackend, Statement};
|
||||||
use tracing_unwrap::ResultExt;
|
use tracing_unwrap::ResultExt;
|
||||||
|
|
||||||
|
|
||||||
pub static DBCONN: LazyStatic<DbConn> = LazyStatic::new(|| {
|
pub static DBCONN: LazyStatic<DbConn> = LazyStatic::new(|| {
|
||||||
trace::info!(
|
trace::info!(
|
||||||
"Connecting to database \"{}\" using a pool of {} connections",
|
"Connecting to database \"{}\" using a pool of {} connections",
|
||||||
|
|
@ -61,7 +60,6 @@ pub static DBCONN: LazyStatic<DbConn> = LazyStatic::new(|| {
|
||||||
.expect_or_log("Failed to connect to database")
|
.expect_or_log("Failed to connect to database")
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
static DBBACKEND: LazyStatic<DatabaseBackend> = LazyStatic::new(||
|
static DBBACKEND: LazyStatic<DatabaseBackend> = LazyStatic::new(||
|
||||||
DBCONN.get_database_backend()
|
DBCONN.get_database_backend()
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,9 @@ use crate::{config, trace, LazyStatic};
|
||||||
|
|
||||||
use unic_langid::LanguageIdentifier;
|
use unic_langid::LanguageIdentifier;
|
||||||
|
|
||||||
// LOCALIZACIÓN ************************************************************************************
|
|
||||||
|
|
||||||
/// Almacena el Identificador de Idioma Unicode
|
/// Almacena el Identificador de Idioma Unicode
|
||||||
/// ([Unicode Language Identifier](https://unicode.org/reports/tr35/tr35.html#Unicode_language_identifier))
|
/// ([Unicode Language Identifier](https://unicode.org/reports/tr35/tr35.html#Unicode_language_identifier))
|
||||||
/// global para la aplicación, obtenido de `SETTINGS.app.language`.
|
/// para la aplicación, obtenido de `SETTINGS.app.language`.
|
||||||
pub static LANGID: LazyStatic<LanguageIdentifier> =
|
pub static LANGID: LazyStatic<LanguageIdentifier> =
|
||||||
LazyStatic::new(|| match config::SETTINGS.app.language.parse() {
|
LazyStatic::new(|| match config::SETTINGS.app.language.parse() {
|
||||||
Ok(language) => language,
|
Ok(language) => language,
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ use crate::{config, LazyStatic};
|
||||||
use tracing_appender::non_blocking::WorkerGuard;
|
use tracing_appender::non_blocking::WorkerGuard;
|
||||||
use tracing_subscriber::EnvFilter;
|
use tracing_subscriber::EnvFilter;
|
||||||
|
|
||||||
|
|
||||||
/// Registro de trazas y eventos de la aplicación.
|
/// Registro de trazas y eventos de la aplicación.
|
||||||
///
|
///
|
||||||
/// Para aumentar el rendimiento, un subproceso dedicado utiliza un sistema de escritura sin bloqueo
|
/// Para aumentar el rendimiento, un subproceso dedicado utiliza un sistema de escritura sin bloqueo
|
||||||
|
|
|
||||||
|
|
@ -78,12 +78,11 @@
|
||||||
//! );
|
//! );
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! De hecho, así se declaran los ajustes globales de la configuración (ver
|
//! De hecho, así se declaran los ajustes globales de la configuración (ver [`SETTINGS`]).
|
||||||
//! [`SETTINGS`](crate::global::SETTINGS)).
|
|
||||||
//!
|
//!
|
||||||
//! Puedes usar la [sintaxis TOML](https://toml.io/en/v1.0.0#table) para añadir tu nueva sección
|
//! Puedes usar la [sintaxis TOML](https://toml.io/en/v1.0.0#table) para añadir tu nueva sección
|
||||||
//! `[myapp]` en los archivos de configuración, del mismo modo que se añaden `[log]` o `[server]` en
|
//! `[myapp]` en los archivos de configuración, del mismo modo que se añaden `[log]` o `[server]` en
|
||||||
//! los ajustes globales (ver [`Settings`](crate::global::Settings)).
|
//! los ajustes globales (ver [`Settings`]).
|
||||||
//!
|
//!
|
||||||
//! Se recomienda inicializar todos los ajustes con valores predefinidos, o utilizar la notación
|
//! Se recomienda inicializar todos los ajustes con valores predefinidos, o utilizar la notación
|
||||||
//! `Option<T>` si van a ser tratados en el código como opcionales.
|
//! `Option<T>` si van a ser tratados en el código como opcionales.
|
||||||
|
|
@ -100,9 +99,9 @@
|
||||||
//! use pagetop::prelude::*;
|
//! use pagetop::prelude::*;
|
||||||
//!
|
//!
|
||||||
//! fn global_settings() {
|
//! fn global_settings() {
|
||||||
//! println!("App name: {}", &global::SETTINGS.app.name);
|
//! println!("App name: {}", &config::SETTINGS.app.name);
|
||||||
//! println!("App description: {}", &global::SETTINGS.app.description);
|
//! println!("App description: {}", &config::SETTINGS.app.description);
|
||||||
//! println!("Value of PAGETOP_RUN_MODE: {}", &global::SETTINGS.app.run_mode);
|
//! println!("Value of PAGETOP_RUN_MODE: {}", &config::SETTINGS.app.run_mode);
|
||||||
//! }
|
//! }
|
||||||
//!
|
//!
|
||||||
//! fn module_settings() {
|
//! fn module_settings() {
|
||||||
|
|
@ -128,7 +127,6 @@ use serde::Deserialize;
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
|
|
||||||
/// Directorio donde se encuentran los archivos de configuración.
|
/// Directorio donde se encuentran los archivos de configuración.
|
||||||
const CONFIG_DIR: &str = "config";
|
const CONFIG_DIR: &str = "config";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ pub use url::Url as DbUri;
|
||||||
|
|
||||||
pub use sea_orm::{DatabaseConnection as DbConn, ExecResult, QueryResult};
|
pub use sea_orm::{DatabaseConnection as DbConn, ExecResult, QueryResult};
|
||||||
|
|
||||||
|
|
||||||
// El siguiente módulo migration es una versión simplificada del módulo sea_orm_migration (v0.9.1)
|
// El siguiente módulo migration es una versión simplificada del módulo sea_orm_migration (v0.9.1)
|
||||||
// https://github.com/SeaQL/sea-orm/tree/0.9.1/sea-orm-migration para evitar los errores generados
|
// https://github.com/SeaQL/sea-orm/tree/0.9.1/sea-orm-migration para evitar los errores generados
|
||||||
// por el paradigma modular de PageTop. Se copian los siguientes archivos del original:
|
// por el paradigma modular de PageTop. Se copian los siguientes archivos del original:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue