# Defs Library

## Rust Libraries Collections to declare and define **applications**

Part of the following developments:

- [Klouds](https://rlung.librecloud.online/LibreCloud/Klouds#klouds)
- [CloudMandala](https://rlung.librecloud.online/LibreCloud/CloudMandala#cloudmandala)
- [Zteron](https://rlung.librecloud.online/LibreCloud/CloudMandala#cloudmandala)

Includes applications definitions and functions for following areas:

- Authorization access
- Configuration and enviroment
- Error handling
- File & basic storages
- [Klouds](https://rlung.librecloud.online/LibreCloud/Klouds#klouds) definitions

### Criteria

In a basic application scenario this group or library collections are included together.
**app_env** is <u>used</u> even inside other libraries.

Updating packages or dependencies shoud be keep in sync among <u>Cargo.toml</u> declarations.

### How to use

1 - Clone or download this lib in a path, better outside of target development

2 - Get current version from <u>Cargo.toml</u>

3 - <u>For each member of</u>  of **Defs Library** one line like the one below should be included in <u>target development Cargo.toml</u> (adjust version & path) and **use** whatever is need.

```toml
app_auth = { version = "0.1.0", path = "../lib/defs/app_auth" }
```

To include all libraries:

```toml
app_auth = { version = "0.1.0", path = "../lib/defs/app_auth" }
app_env = { version = "0.1.0", path = "../lib/defs/app_env" }
app_errors = { version = "0.1.0", path = "../lib/defs/app_errors" }
app_file = { version = "0.1.0", path = "../lib/defs/app_file" }
kloud = { version = "0.1.0", path = "../lib/defs/kloud" }
```

### Structure

Each directory contains a Library dedicated to applications common needs:
Inside of each directory README.md and TODO.md files has more details.

#### app_auth

An authorization library based in [Casbin](https://casbin.org/) [Rust library](https://github.com/casbin/casbin-rs) 

<pre>
app_auth/
├── Cargo.toml
├── README.md
├── TODO.md
└── src
    └── lib.rs
</pre>

#### app_env

Dedicated to load configuration, enviroment settings, profiles, collections, etc.

<pre>
app_env/
├── Cargo.toml
├── README.md
├── TODO.md
└── src
    ├── appdata.rs
    ├── appenv.rs
    ├── appinfo.rs
    ├── config.rs
    ├── lib.rs
    ├── module.rs
    └── profile.rs
</pre>

#### app_errors

Define common applications errors

<pre>
app_errors/
├── Cargo.toml
├── README.md
├── TODO.md
└── src
    └── lib.rs
</pre>

#### app_file

To handle common application files and storages.

<pre>
app_file/
├── Cargo.toml
├── README.md
├── TODO.md
└── src
    └── lib.rs
</pre>

#### kloud

Basic definitions and utilities

<pre>
kloud
├── Cargo.toml
├── README.md
├── TODO.md
├── src
│   ├── datacontext.rs
│   ├── defs.rs
│   ├── kloud.rs
│   ├── lang.rs
│   ├── lib.rs
│   └── utils.rs
</pre>

## Author

- [Jesús Pérez](https://info.jesusperez.pro).

## License

MIT