Files
herolib/lib/installers/db/meilisearch_installer/meilisearch_installer_model.v
Mahmoud Emad 3a337b7b0a refactor: fix meilisearch installler and rename meilisearchinstaller to meilisearch_installer
- Renamed the `meilisearchinstaller` module and related files to  `meilisearch_installer` for consistency.
- Updated import statements and references accordingly.
- Added functionality to install, start, and destroy the  Meilisearch service.
- Improved code readability and organization.
2025-02-12 11:06:08 +00:00

61 lines
1.3 KiB
V

module meilisearch_installer
import freeflowuniverse.herolib.data.encoderhero
pub const version = '1.11.3'
const singleton = false
const default = true
// THIS THE THE SOURCE OF THE INFORMATION OF THIS FILE, HERE WE HAVE THE CONFIG OBJECT CONFIGURED AND MODELLED
@[heap]
pub struct MeilisearchInstaller {
pub mut:
name string = 'default'
path string = '/tmp/meilisearch'
masterkey string @[secret]
host string = 'localhost'
port int = 7700
production bool
}
// your checking & initialization code if needed
fn obj_init(mycfg_ MeilisearchInstaller) !MeilisearchInstaller {
mut mycfg := mycfg_
if mycfg.masterkey == '' {
mycfg.masterkey = generate_master_key(16)!
}
if mycfg.path == '' {
mycfg.path = '/tmp/meilisearch'
}
if mycfg.host == '' {
mycfg.host = 'localhost'
}
if mycfg.port == 0 {
mycfg.port = 7700
}
if mycfg.name == '' {
mycfg.name = 'default'
}
return mycfg
}
// called before start if done
fn configure() ! {
// mut installer := get()!
}
/////////////NORMALLY NO NEED TO TOUCH
pub fn heroscript_dumps(obj MeilisearchInstaller) !string {
return encoderhero.encode[MeilisearchInstaller](obj)!
}
pub fn heroscript_loads(heroscript string) !MeilisearchInstaller {
mut obj := encoderhero.decode[MeilisearchInstaller](heroscript)!
return obj
}