mirror of
https://github.com/fluxerapp/fluxer.git
synced 2026-12-04 16:13:04 -08:00
feat(rexctl): check and plan for an external Meilisearch
This commit is contained in:
3 files changed
+27
No files matched your search
@@ -152,6 +152,10 @@ func Prepare(inst *instance.Instance, changes map[string]*string) (*Prepared, er
|
||||
if next[settings.StorageSecret] != st.Settings[settings.StorageSecret] && next[settings.StorageEndpoint] == "" && next[settings.StorageSecret] != "" {
|
||||
return nil, ui.Refused("storage.secret_key only applies to your own object store.", "Set storage.endpoint in the same command, for example rexctl config set storage.endpoint=https://s3.example.com storage.secret_key=-.")
|
||||
}
|
||||
if stack.ExternalMeilisearch(next) && strings.TrimSpace(next[stack.SearchURLVar]) == "" && slices.ContainsFunc(changed, searchSetting) {
|
||||
return nil, ui.Refused(stack.MeilisearchBundledVar+" is false, so Fluxer needs the address of your own Meilisearch.",
|
||||
"Set "+stack.SearchURLVar+" in the same command, for example rexctl config set "+stack.MeilisearchBundledVar+"=false "+stack.SearchURLVar+"=https://search.example.com.")
|
||||
}
|
||||
if st.Upgrade != nil && !repairs {
|
||||
if err := refuseUpgrade(inst); err != nil {
|
||||
return nil, err
|
||||
@@ -169,6 +173,10 @@ func Prepare(inst *instance.Instance, changes map[string]*string) (*Prepared, er
|
||||
return &Prepared{Set: rs, Keys: keys, Settings: next, Secrets: nextSecrets, Preview: Preview{Keys: changed}}, nil
|
||||
}
|
||||
|
||||
func searchSetting(name string) bool {
|
||||
return name == stack.MeilisearchBundledVar || name == stack.SearchURLVar || name == stack.SearchEngineVar
|
||||
}
|
||||
|
||||
func brokenVAPID(st *instance.State, name string) bool {
|
||||
if name != secrets.VAPIDPublicKey && name != secrets.VAPIDPrivateKey {
|
||||
return false
|
||||
|
||||
@@ -205,10 +205,14 @@ var nativeDefault = []string{
|
||||
func NativeChildren(done []Option, chosen map[string]string) []string {
|
||||
env, err := settings.Effective(settings.NativeSet(stack.EmbeddedRelease()), chosen, nil, nil)
|
||||
voice := err == nil && strings.TrimSpace(env[settings.LiveKitEnabled]) == "true" && stack.VoiceBundled(env[stack.VoiceBundledKey])
|
||||
search := err != nil || (stack.MeilisearchSearch(env) && !stack.ExternalMeilisearch(env))
|
||||
out := slices.Clone(nativeDefault)
|
||||
if err == nil && strings.EqualFold(strings.TrimSpace(env[settings.UnfurlEnabled]), "false") {
|
||||
out = slices.DeleteFunc(out, func(c string) bool { return c == "unfurl" })
|
||||
}
|
||||
if !search {
|
||||
out = slices.DeleteFunc(out, func(c string) bool { return c == "meilisearch" })
|
||||
}
|
||||
for _, o := range done {
|
||||
out = slices.DeleteFunc(out, func(c string) bool { return slices.Contains(retired[o], c) })
|
||||
if o == OptRust {
|
||||
|
||||
@@ -42,6 +42,21 @@ var DataMounts = map[string]DataMount{
|
||||
ObjectsVolume: {Service: "media-proxy", Target: ObjectsRoot},
|
||||
}
|
||||
|
||||
const (
|
||||
SearchEngineVar = "FLUXER_SEARCH_ENGINE"
|
||||
SearchURLVar = "FLUXER_SEARCH_URL"
|
||||
MeilisearchBundledVar = "FLUXER_MEILISEARCH_BUNDLED"
|
||||
)
|
||||
|
||||
func MeilisearchSearch(settings map[string]string) bool {
|
||||
engine := strings.TrimSpace(settings[SearchEngineVar])
|
||||
return engine == "" || engine == "meilisearch"
|
||||
}
|
||||
|
||||
func ExternalMeilisearch(settings map[string]string) bool {
|
||||
return MeilisearchSearch(settings) && strings.TrimSpace(settings[MeilisearchBundledVar]) == "false"
|
||||
}
|
||||
|
||||
func FilesystemStorage(settings map[string]string) bool {
|
||||
return strings.TrimSpace(settings["storage.backend"]) == "filesystem"
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user