Rename to myco

This commit is contained in:
eraden 2023-06-20 07:03:15 +02:00
parent 132fb52358
commit e97928de36
15 changed files with 86 additions and 82 deletions

18
.env
View File

@ -1,17 +1,17 @@
DATABASE_NAME=bazzar
DATABASE_URL=postgres://postgres@localhost/bazzar
ACCOUNT_DATABASE_URL=postgres://postgres@localhost/bazzar_accounts
CART_DATABASE_URL=postgres://postgres@localhost/bazzar_carts
STOCK_DATABASE_URL=postgres://postgres@localhost/bazzar_stocks
ORDER_DATABASE_URL=postgres://postgres@localhost/bazzar_orders
TOKEN_DATABASE_URL=postgres://postgres@localhost/bazzar_tokens
DATABASE_NAME=myco
DATABASE_URL=postgres://postgres@localhost/myco
ACCOUNT_DATABASE_URL=postgres://postgres@localhost/myco_accounts
CART_DATABASE_URL=postgres://postgres@localhost/myco_carts
STOCK_DATABASE_URL=postgres://postgres@localhost/myco_stocks
ORDER_DATABASE_URL=postgres://postgres@localhost/myco_orders
TOKEN_DATABASE_URL=postgres://postgres@localhost/myco_tokens
PASS_SALT=18CHwV7eGFAea16z+qMKZg
RUST_LOG=debug
SESSION_SECRET="NEPJs#8jjn8SK8GC7QEC^*P844UgsyEbQB8mRWXkT%3mPrwewZoc25MMby9H#R*w2KzaQgMkk#Pif$kxrLy*N5L!Ch%jxbWoa%gb"
JWT_SECRET="42^iFq&ZnQbUf!hwGWXd&CpyY6QQyJmkPU%esFCvne5&Ejcb3nJ4&GyHZp!MArZLf^9*5c6!!VgM$iZ8T%d#&bWTi&xbZk2S@4RN"
SIGNATURE=David
SERVICE_NAME="BaZZaR develop"
SERVICE_NAME="myco develop"
PGDATESTYLE=
@ -27,7 +27,7 @@ PAYU_CLIENT_MERCHANT_ID=300746
TPAY_TRANSACTION_API_KEY=75f86137a6635df826e3efe2e66f7c9a946fdde1
TPAY_CARDS_API_KEY=bda5eda723bf1ae71a82e90a249803d3f852248d
#WEB_HOST=https://bazzar.ita-prog.pl
#WEB_HOST=https://myco.ita-prog.pl
WEB_HOST=0.0.0.0
FILES_PUBLIC_PATH=/files

View File

@ -1,4 +1,8 @@
# Bazzar
# MycoCraft
Short `Myco` is Rust e-commerce design for possibility to have monolith or microservices, fast, safe, cheap and extensible with plugins e-commerce.
Origin of the name is Myco-heterotrophy which is symbiotic relationship between fungus and plans which benefits both.
### Order life cycle

View File

@ -1,5 +1,5 @@
[package]
name = "bazzar"
name = "myco"
version = "0.1.0"
edition = "2021"

View File

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Bazzar</title>
<title>Myco</title>
<style>
@import url(https://fonts.googleapis.com/css?family=Questrial);
@import url(https://fonts.googleapis.com/css?family=Arvo);

View File

@ -8,7 +8,7 @@ pub trait ResolveDbUrl {
fn db_url(&self) -> String {
self.own_db_url()
.or_else(|| std::env::var("DATABASE_URL").ok())
.unwrap_or_else(|| String::from("postgres://postgres@localhost/bazzar"))
.unwrap_or_else(|| String::from("postgres://postgres@localhost/myco"))
}
}

View File

@ -67,13 +67,13 @@ impl Example for WebConfig {
fn example() -> Self {
Self {
host: Some("https://your.comain.com".into()),
pass_salt: Some("Generate it with bazzar generate-hash".into()),
pass_salt: Some("Generate it with myco generate-hash".into()),
session_secret: Some("100 characters long random string".into()),
jwt_secret: Some("100 characters long random string".into()),
bind: Some("0.0.0.0".into()),
port: Some(8080),
signature: Some("John Doe".into()),
service_name: Some("bazzar".into()),
service_name: Some("myco".into()),
}
}
}
@ -126,7 +126,7 @@ impl WebConfig {
self.bind
.as_ref()
.cloned()
.or_else(|| std::env::var("BAZZAR_BIND").ok())
.or_else(|| std::env::var("myco_BIND").ok())
}
pub fn set_bind<S: Into<String>>(&mut self, bind: S) {
@ -135,7 +135,7 @@ impl WebConfig {
pub fn port(&self) -> Option<u16> {
self.port.as_ref().copied().or_else(|| {
std::env::var("BAZZAR_PORT")
std::env::var("myco_PORT")
.ok()
.and_then(|s| s.parse::<u16>().ok())
})
@ -215,7 +215,7 @@ pub struct DatabaseConfig {
impl Example for DatabaseConfig {
fn example() -> Self {
Self {
url: Some("postgres://postgres@localhost/bazzar".into()),
url: Some("postgres://postgres@localhost/myco".into()),
}
}
}
@ -323,7 +323,7 @@ impl Default for FilesConfig {
fn default() -> Self {
Self {
public_path: Some("/uploads".into()),
local_path: Some("/var/local/bazzar".into()),
local_path: Some("/var/local/myco".into()),
}
}
}
@ -342,7 +342,7 @@ impl FilesConfig {
.as_ref()
.cloned()
.or_else(|| std::env::var("FILES_LOCAL_PATH").ok())
.unwrap_or_else(|| "/var/local/bazzar".into())
.unwrap_or_else(|| "/var/local/myco".into())
}
}
@ -362,7 +362,7 @@ impl Default for AccountManagerConfig {
rpc_bind: "0.0.0.0".into(),
mqtt_port: 1883,
mqtt_bind: "0.0.0.0".into(),
database_url: "postgres://postgres@localhost/bazzar_accounts".into(),
database_url: "postgres://postgres@localhost/myco_accounts".into(),
}
}
}
@ -395,7 +395,7 @@ impl Default for CartManagerConfig {
rpc_bind: "0.0.0.0".into(),
mqtt_port: 1884,
mqtt_bind: "0.0.0.0".into(),
database_url: "postgres://postgres@localhost/bazzar_carts".into(),
database_url: "postgres://postgres@localhost/myco_carts".into(),
}
}
}
@ -427,7 +427,7 @@ impl Default for EmailSenderConfig {
rpc_bind: "0.0.0.0".into(),
mqtt_port: 1885,
mqtt_bind: "0.0.0.0".into(),
database_url: "postgres://postgres@localhost/bazzar_emails".into(),
database_url: "postgres://postgres@localhost/myco_emails".into(),
}
}
}
@ -462,7 +462,7 @@ impl Default for StocksConfig {
rpc_bind: "0.0.0.0".into(),
mqtt_port: 1886,
mqtt_bind: "0.0.0.0".into(),
database_url: "postgres://postgres@localhost/bazzar_stocks".into(),
database_url: "postgres://postgres@localhost/myco_stocks".into(),
}
}
}
@ -495,7 +495,7 @@ impl Default for OrderConfig {
rpc_bind: "0.0.0.0".into(),
mqtt_port: 1887,
mqtt_bind: "0.0.0.0".into(),
database_url: "postgres://postgres@localhost/bazzar_orders".into(),
database_url: "postgres://postgres@localhost/myco_orders".into(),
}
}
}
@ -641,7 +641,7 @@ impl Default for TokensConfig {
rpc_bind: "0.0.0.0".into(),
mqtt_port: 1889,
mqtt_bind: "0.0.0.0".into(),
database_url: "postgres://postgres@localhost/bazzar_tokens".into(),
database_url: "postgres://postgres@localhost/myco_tokens".into(),
}
}
}
@ -802,7 +802,7 @@ impl Default for AppConfig {
}
pub fn default_load(opts: &impl UpdateConfig) -> SharedAppConfig {
load("./bazzar.toml", opts)
load("./myco.toml", opts)
}
pub fn load(config_path: &str, opts: &impl UpdateConfig) -> SharedAppConfig {
@ -819,7 +819,7 @@ pub fn load(config_path: &str, opts: &impl UpdateConfig) -> SharedAppConfig {
let config = AppConfig::example();
std::fs::write(config_path, toml::to_string_pretty(&config).unwrap()).unwrap();
eprintln!("Config was automatically generated");
eprintln!("Please review ./bazzar.toml, fill all fields or provide all environment variables in .env");
eprintln!("Please review ./myco.toml, fill all fields or provide all environment variables in .env");
eprintln!("And restart service.");
std::process::exit(1);
}
@ -841,8 +841,8 @@ WEB_HOST - your domain name, it's required for PayU notifications, service email
PASS_SALT - password encryption secret string, you can generate it with this CLI
SESSION_SECRET - 100 characters admin session encryption
JWT_SECRET - 100 characters user session encryption
BAZZAR_BIND - address to which server should be bind, typically 0.0.0.0
BAZZAR_PORT - port which server should use, typically 80
myco_BIND - address to which server should be bind, typically 0.0.0.0
myco_PORT - port which server should use, typically 80
SIGNATURE - Signature used in e-mails
SERVICE_NAME - Shop name
@ -850,7 +850,7 @@ SENDGRID_SECRET - e-mail sending service secret
SENDGRID_API_KEY - e-mail sending service api key
SMTP_FROM - e-mail sending service authorized e-mail address used as sender e-mail address
DATABASE_URL - postgresql address (ex. postgres://postgres@localhost/bazzar)
DATABASE_URL - postgresql address (ex. postgres://postgres@localhost/myco)
SONIC_SEARCH_ADDR - search engine query address
SONIC_SEARCH_PASS - search engine query password

View File

@ -107,7 +107,7 @@ mod tests {
#[actix::test]
async fn check_lookup() {
let config = config::load("../../bazzar.toml", &Opts);
let config = config::load("../../myco.toml", &Opts);
let ctx = crate::Context::new(config.clone()).unwrap();
create_index(

View File

@ -1,11 +1,11 @@
#[macro_export]
macro_rules! db_t_ref {
($t: ident) => {
let config = config::load("../../tests/bazzar.toml", &mut NoOpts);
let config = config::load("../../tests/myco.toml", &mut NoOpts);
config
.lock()
.database_mut()
.set_url("postgres://postgres@localhost/bazzar_test");
.set_url("postgres://postgres@localhost/myco_test");
let db = Database::build(config).await;
let pool = db.pool();
@ -16,11 +16,11 @@ macro_rules! db_t_ref {
#[macro_export]
macro_rules! db {
($config: ident, $db: ident) => {
let $config = config::load("../../tests/bazzar.toml", &mut NoOpts);
let $config = config::load("../../tests/myco.toml", &mut NoOpts);
$config
.lock()
.database_mut()
.set_url("postgres://postgres@localhost/bazzar_test");
.set_url("postgres://postgres@localhost/myco_test");
let $db = Database::build($config.clone()).await;
};

View File

@ -17,7 +17,7 @@ CREATE TABLE tokens
id integer NOT NULL,
customer_id uuid NOT NULL,
role "Role" NOT NULL,
issuer character varying DEFAULT 'bazzar'::character varying NOT NULL,
issuer character varying DEFAULT 'myco'::character varying NOT NULL,
subject integer NOT NULL,
audience "Audience" DEFAULT 'web'::"Audience" NOT NULL,
expiration_time timestamp without time zone DEFAULT (now() + '14 days'::interval) NOT NULL,

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link id="logo" data-trunk rel="icon" href="assets/logo.png" >
<title>Bazzar</title>
<title>Myco</title>
<link data-trunk rel="css" href="tmp/tailwind.css"/>
<link rel="copy-file" href="assets/logo.png">
<link rel="copy-file" href="tmp/tailwind.css">

View File

@ -2,21 +2,21 @@
'https://plantuml.com/deployment-diagram
rectangle "Dependencies" {
database bazzar_accounts2 [
database myco_accounts2 [
PostgreSQL
---
bazzar_accounts
myco_accounts
]
database bazzar_carts2 [
database myco_carts2 [
PostgreSQL
---
bazzar_carts
myco_carts
]
database "sonic "
database bazzar_stocks2 [
database myco_stocks2 [
PostgreSQL
---
bazzar_stocks
myco_stocks
]
cloud "sendgrid "
queue "rumqttd "

View File

@ -6,18 +6,18 @@ scale 1000
rectangle "API" {
' left to right direction
node "bazzar"
node "myco"
queue rumqttd
component "Accounts" {
node "account-manager"
database bazzar_accounts [
database myco_accounts [
PostgreSQL
---
bazzar_accounts
myco_accounts
]
"account-manager" <-up-> bazzar_accounts
"account-manager" <-up-> myco_accounts
"account-manager" --> rumqttd : emit event
usecase create_account [
@ -50,13 +50,13 @@ rectangle "API" {
component "Carts" {
node "cart-manager"
database bazzar_carts [
database myco_carts [
PostgreSQL
---
bazzar_carts
myco_carts
]
"cart-manager" <-up-> bazzar_carts
"cart-manager" <-up-> myco_carts
usecase modify_item [
Modify
@ -115,13 +115,13 @@ rectangle "API" {
component "Stocks" {
node "stock-manager"
database bazzar_stocks [
database myco_stocks [
PostgreSQL
---
bazzar_stocks
myco_stocks
]
"stock-manager" <-up-> bazzar_stocks
"stock-manager" <-up-> myco_stocks
"stock-manager" --> rumqttd : emit event
circle product [
@ -249,14 +249,14 @@ rectangle "API" {
cloud
service
]
database bazzar_payments [
database myco_payments [
PostgreSQL
---
bazzar_payments
myco_payments
]
"payment-manager" <-up(0)-> payment_service : http
"payment-manager" <-up-> bazzar_payments
"payment-manager" <-up-> myco_payments
"payment-manager" --> rumqttd : emit event
usecase request [
@ -275,13 +275,13 @@ rectangle "API" {
component "Orders" {
node "order-manager"
database bazzar_orders [
database myco_orders [
PostgreSQL
---
bazzar_orders
myco_orders
]
"order-manager" <-up-> bazzar_orders
"order-manager" <-up-> myco_orders
"order-manager" --> rumqttd : emit event
usecase create_order [
@ -308,13 +308,13 @@ rectangle "API" {
component "Tokens" {
node "token-manager"
database bazzar_tokens [
database myco_tokens [
PostgreSQL
---
bazzar_tokens
myco_tokens
]
"token-manager" <-up-> bazzar_tokens
"token-manager" <-up-> myco_tokens
"token-manager" --> rumqttd : emit event
usecase create_jwt [
@ -338,14 +338,14 @@ rectangle "API" {
rectangle {
actor " rumqttd"
"bazzar" -- "Accounts" : rpc
"bazzar" -- "Carts" : rpc
"bazzar" -- "Stocks" : rpc
"bazzar" -- "Search" : rpc
"bazzar" -- "E-Mail" : rpc
"bazzar" -- "Tokens" : rpc
"bazzar" -- "Payments" : rpc
"bazzar" --> " rumqttd" : emit event
"myco" -- "Accounts" : rpc
"myco" -- "Carts" : rpc
"myco" -- "Stocks" : rpc
"myco" -- "Search" : rpc
"myco" -- "E-Mail" : rpc
"myco" -- "Tokens" : rpc
"myco" -- "Payments" : rpc
"myco" --> " rumqttd" : emit event
}
}

View File

@ -55,7 +55,7 @@ impl Migration {
Stores,
&mut [
Id.col().uuid().not_null().primary_key().default_gen_uuid(),
Name.col().string().default("Bazzar".to_string()).not_null(),
Name.col().string().default("myco".to_string()).not_null(),
DefaultCurrencyCode.col().string().default("pln").not_null(),
SwapLinkTemplate.col().string(),
CreatedAt.col().timestamp().not_null().default_now(),

View File

@ -7,7 +7,7 @@ fi
./scripts/migrate.sh purge
rm ./crates/**/bazzar.toml
rm ./crates/**/myco.toml
cargo nextest run --workspace --exclude database_manager
@ -19,4 +19,4 @@ cargo nextest run --workspace --exclude database_manager
#cargo test --bin search-manager
#cargo test --bin stock-manager
##cargo test --bin token_manager
#cargo test --bin bazzar
#cargo test --bin myco

View File

@ -6,13 +6,13 @@ optional_payment = true
[web]
host = 'https://your.comain.com'
pass_salt = 'Generate it with bazzar generate-hash'
pass_salt = 'Generate it with myco generate-hash'
session_secret = '100 characters long random string'
jwt_secret = '100 characters long random string'
bind = '0.0.0.0'
port = 8080
signature = 'John Doe'
service_name = 'bazzar'
service_name = 'myco'
[mail]
sendgrid_secret = 'Create sendgrid account and copy credentials here'
@ -20,7 +20,7 @@ sendgrid_api_key = 'Create sendgrid account and copy credentials here'
smtp_from = 'Valid sendgrid authorized email address. Example: contact@example.com'
[database]
url = 'postgres://postgres@localhost/bazzar'
url = 'postgres://postgres@localhost/myco'
[search]
sonic_search_addr = '[::1]:1491'
@ -33,32 +33,32 @@ search_active = true
[files]
public_path = '/uploads'
local_path = '/var/local/bazzar'
local_path = '/var/local/myco'
[account_manager]
rpc_port = 19329
rpc_bind = '0.0.0.0'
mqtt_port = 1883
mqtt_bind = '0.0.0.0'
database_url = 'postgres://postgres@localhost/bazzar_accounts'
database_url = 'postgres://postgres@localhost/myco_accounts'
[cart_manager]
rpc_port = 19330
rpc_bind = '0.0.0.0'
mqtt_port = 1884
mqtt_bind = '0.0.0.0'
database_url = 'postgres://postgres@localhost/bazzar_carts'
database_url = 'postgres://postgres@localhost/myco_carts'
[email_sender]
rpc_port = 19331
rpc_bind = '0.0.0.0'
mqtt_port = 1885
mqtt_bind = '0.0.0.0'
database_url = 'postgres://postgres@localhost/bazzar_emails'
database_url = 'postgres://postgres@localhost/myco_emails'
[stocks]
rpc_port = 19333
rpc_bind = '0.0.0.0'
mqtt_port = 1886
mqtt_bind = '0.0.0.0'
database_url = 'postgres://postgres@localhost/bazzar_stocks'
database_url = 'postgres://postgres@localhost/myco_stocks'