Skip to content

Commit

Permalink
test with random string
Browse files Browse the repository at this point in the history
  • Loading branch information
Pwd9000-ML committed Jan 21, 2024
1 parent f387700 commit 0e97190
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 45 deletions.
25 changes: 10 additions & 15 deletions 06_librechat_app.tf
Original file line number Diff line number Diff line change
@@ -1,63 +1,58 @@
# Generate random strings as keys for meilisearch and librechat (Stored securely in Azure Key Vault)
resource "random_password" "meilisearch_master_key" {
resource "random_string" "meilisearch_master_key" {
length = 20
special = false
upper = false
}

resource "azurerm_key_vault_secret" "meilisearch_master_key" {
name = "${var.meilisearch_app_name}-master-key"
value = random_password.meilisearch_master_key.result
value = random_string.meilisearch_master_key.result
key_vault_id = azurerm_key_vault.az_openai_kv.id
}

# LibreChat CREDS key (64 characters in hex) and 16-byte IV (32 characters in hex)
resource "random_password" "libre_app_creds_key" {
resource "random_string" "libre_app_creds_key" {
length = 64
special = false
upper = false
}

resource "random_password" "libre_app_creds_iv" {
resource "random_string" "libre_app_creds_iv" {
length = 32
special = false
upper = false
}

resource "azurerm_key_vault_secret" "libre_app_creds_key" {
name = "${var.libre_app_name}-key"
value = random_password.libre_app_creds_key.result
value = random_string.libre_app_creds_key.result
key_vault_id = azurerm_key_vault.az_openai_kv.id
}

resource "azurerm_key_vault_secret" "libre_app_creds_iv" {
name = "${var.libre_app_name}-iv"
value = random_password.libre_app_creds_iv.result
value = random_string.libre_app_creds_iv.result
key_vault_id = azurerm_key_vault.az_openai_kv.id
}

# LibreChat JWT Secret (64 characters in hex) and JWT Refresh Secret (64 characters in hex)
resource "random_password" "libre_app_jwt_secret" {
resource "random_string" "libre_app_jwt_secret" {
length = 64
special = false
upper = false
}

resource "random_password" "libre_app_jwt_refresh_secret" {
resource "random_string" "libre_app_jwt_refresh_secret" {
length = 64
special = false
upper = false
}

resource "azurerm_key_vault_secret" "libre_app_jwt_secret" {
name = "${var.libre_app_name}-jwt-secret"
value = random_password.libre_app_jwt_secret.result
value = random_string.libre_app_jwt_secret.result
key_vault_id = azurerm_key_vault.az_openai_kv.id
}

resource "azurerm_key_vault_secret" "libre_app_jwt_refresh_secret" {
name = "${var.libre_app_name}-jwt-refresh-secret"
value = random_password.libre_app_jwt_refresh_secret.result
value = random_string.libre_app_jwt_refresh_secret.result
key_vault_id = azurerm_key_vault.az_openai_kv.id
}

Expand Down
28 changes: 1 addition & 27 deletions 06_librechat_app_config.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,33 +47,7 @@ locals {
MEILI_MASTER_KEY = var.libre_app_meili_key != null ? var.libre_app_meili_key : "@Microsoft.KeyVault(SecretUri=${azurerm_key_vault_secret.meilisearch_master_key.id})"

### User - Balance ###
CHECK_BALANCE = false #######

BAN_VIOLATIONS = true
BAN_DURATION = 1000 * 60 * 60 * 2
BAN_INTERVAL = 20

LOGIN_VIOLATION_SCORE = 1
REGISTRATION_VIOLATION_SCORE = 1
CONCURRENT_VIOLATION_SCORE = 1
MESSAGE_VIOLATION_SCORE = 1
NON_BROWSER_VIOLATION_SCORE = 20

LOGIN_MAX = 7
LOGIN_WINDOW = 5
REGISTER_MAX = 5
REGISTER_WINDOW = 60

LIMIT_CONCURRENT_MESSAGES = true
CONCURRENT_MESSAGE_MAX = 2

LIMIT_MESSAGE_IP = true
MESSAGE_IP_MAX = 40
MESSAGE_IP_WINDOW = 1

LIMIT_MESSAGE_USER = false
MESSAGE_USER_MAX = 40
MESSAGE_USER_WINDOW = 1
#CHECK_BALANCE = false

### User - Registration and Login ###
ALLOW_EMAIL_LOGIN = var.libre_app_allow_email_login #true
Expand Down
6 changes: 3 additions & 3 deletions tests/auto_test1/testing.auto.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ libre_app_virtual_network_subnet_id = null
libre_app_title = "Azure OpenAI LibreChat"
libre_app_custom_footer = "Privately hosted chat app powered by Azure OpenAI and LibreChat"
libre_app_host = "0.0.0.0"
libre_app_port = 8080
libre_app_port = 80
libre_app_mongo_uri = null
libre_app_domain_client = "http://localhost:8080"
libre_app_domain_server = "http://localhost:8080"
libre_app_domain_client = "http://localhost:3080"
libre_app_domain_server = "http://localhost:3080"

# debug logging
libre_app_debug_logging = true
Expand Down

0 comments on commit 0e97190

Please sign in to comment.