From cad271350bbfd19ef1da64658879c875812b7d48 Mon Sep 17 00:00:00 2001 From: phact Date: Wed, 3 Sep 2025 23:03:05 -0400 Subject: [PATCH] langflow auth env vars in tui --- src/tui/managers/env_manager.py | 15 +++++++++++ src/tui/screens/config.py | 45 +++++++++++++++++++++++++++++++-- 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/src/tui/managers/env_manager.py b/src/tui/managers/env_manager.py index 90648849..61ec2f07 100644 --- a/src/tui/managers/env_manager.py +++ b/src/tui/managers/env_manager.py @@ -40,6 +40,11 @@ class EnvConfig: aws_secret_access_key: str = "" langflow_public_url: str = "" + # Langflow auth settings + langflow_auto_login: str = "False" + langflow_new_user_is_active: str = "False" + langflow_enable_superuser_cli: str = "False" + # Document paths (comma-separated) openrag_documents_paths: str = "./documents" @@ -98,6 +103,9 @@ class EnvManager: 'AWS_SECRET_ACCESS_KEY': 'aws_secret_access_key', 'LANGFLOW_PUBLIC_URL': 'langflow_public_url', 'OPENRAG_DOCUMENTS_PATHS': 'openrag_documents_paths', + 'LANGFLOW_AUTO_LOGIN': 'langflow_auto_login', + 'LANGFLOW_NEW_USER_IS_ACTIVE': 'langflow_new_user_is_active', + 'LANGFLOW_ENABLE_SUPERUSER_CLI': 'langflow_enable_superuser_cli', } if key in attr_map: @@ -193,6 +201,13 @@ class EnvManager: f.write(f"OPENRAG_DOCUMENTS_PATHS={self.config.openrag_documents_paths}\n") f.write("\n") + # Langflow auth settings + f.write("# Langflow auth settings\n") + f.write(f"LANGFLOW_AUTO_LOGIN={self.config.langflow_auto_login}\n") + f.write(f"LANGFLOW_NEW_USER_IS_ACTIVE={self.config.langflow_new_user_is_active}\n") + f.write(f"LANGFLOW_ENABLE_SUPERUSER_CLI={self.config.langflow_enable_superuser_cli}\n") + f.write("\n") + # OAuth settings if self.config.google_oauth_client_id or self.config.google_oauth_client_secret: f.write("# Google OAuth settings\n") diff --git a/src/tui/screens/config.py b/src/tui/screens/config.py index d31b02dc..1a0fb683 100644 --- a/src/tui/screens/config.py +++ b/src/tui/screens/config.py @@ -282,6 +282,47 @@ class ConfigScreen(Screen): self.inputs["openrag_documents_paths"] = input_widget yield Static(" ") + # Langflow Auth Settings + yield Static("Langflow Auth Settings", classes="tab-header") + yield Static(" ") + + # Langflow Auto Login + yield Label("Langflow Auto Login") + current_value = getattr(self.env_manager.config, "langflow_auto_login", "False") + input_widget = Input( + placeholder="False", + value=current_value, + id="input-langflow_auto_login" + ) + yield input_widget + self.inputs["langflow_auto_login"] = input_widget + yield Static(" ") + + # Langflow New User Is Active + yield Label("Langflow New User Is Active") + current_value = getattr(self.env_manager.config, "langflow_new_user_is_active", "False") + input_widget = Input( + placeholder="False", + value=current_value, + id="input-langflow_new_user_is_active" + ) + yield input_widget + self.inputs["langflow_new_user_is_active"] = input_widget + yield Static(" ") + + # Langflow Enable Superuser CLI + yield Label("Langflow Enable Superuser CLI") + current_value = getattr(self.env_manager.config, "langflow_enable_superuser_cli", "False") + input_widget = Input( + placeholder="False", + value=current_value, + id="input-langflow_enable_superuser_cli" + ) + yield input_widget + self.inputs["langflow_enable_superuser_cli"] = input_widget + yield Static(" ") + yield Static(" ") + # Langflow Secret Key removed from UI; generated automatically on save # Add optional fields only in full mode @@ -379,7 +420,7 @@ class ConfigScreen(Screen): new_value = getattr(self.env_manager.config, field_name) input_widget.value = new_value - self.notify("Generated secure passwords", severity="info") + self.notify("Generated secure passwords", severity="information") def action_save(self) -> None: """Save the configuration.""" @@ -398,7 +439,7 @@ class ConfigScreen(Screen): # Save to file if self.env_manager.save_env_file(): - self.notify("Configuration saved successfully!", severity="success") + self.notify("Configuration saved successfully!", severity="information") # Switch to monitor screen from .monitor import MonitorScreen self.app.push_screen(MonitorScreen())