diff --git a/.gitignore b/.gitignore index 02f42a1b6b..29825090aa 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ node_modules yarn-error.log playbook/stats.json *.dec.* +.env diff --git a/playbook-website/.gitignore b/playbook-website/.gitignore index 7589e0e431..651de6e0c6 100644 --- a/playbook-website/.gitignore +++ b/playbook-website/.gitignore @@ -35,4 +35,5 @@ yarn-debug.log* # Vite uses dotenv and suggests to ignore local-only env files. See # https://vitejs.dev/guide/env-and-mode.html#env-files *.local +.env diff --git a/playbook-website/config/application.rb b/playbook-website/config/application.rb index 786e521774..547d78312c 100644 --- a/playbook-website/config/application.rb +++ b/playbook-website/config/application.rb @@ -38,6 +38,10 @@ class Application < Rails::Application # config.eager_load_paths << Rails.root.join("extras") # Don't generate system test files. + config.generators.system_tests = nil + + openai_api_key = ENV["OPENAI_API_KEY"] + Rails.application.config.openai_api_key = openai_api_key end end diff --git a/playbook-website/config/deploy/prs/secrets.yaml b/playbook-website/config/deploy/prs/secrets.yaml index 0ca6d4c76e..cab0cc21d0 100644 --- a/playbook-website/config/deploy/prs/secrets.yaml +++ b/playbook-website/config/deploy/prs/secrets.yaml @@ -1,7 +1,7 @@ appConfig: secretKeyBase: ENC[AES256_GCM,data:ydJ6vKcPVMp9SxRCxgKH3AgAX5JjeoGn7fDKf77XkhODoTZnRHpkyiAezdhFhakCajJFHmaOttWytEVJiMg9DoW111f4AWsNQ+awVztblsCUmT1ZPgZtAGH8H76RKzl3adRy466E3FFoBzQf2FZhP5fdDRSmhzlHWUZdtrfDt/g=,iv:fDmiR4EzqRJ72pl4xLjG5Lv3bw6ijE7hqDHY9HqBcF8=,tag:vzpbilZlEFKlKrt9Rl9zvA==,type:str] sentry_dsn: ENC[AES256_GCM,data:ufQrClZMvpS72OLyRqlO4jisNfnC793ASma61YUOssmQ2gUb/H/U5loD731e4a1fI6dADN66cjQbEnBGwNz0tU58dPMFlR5wSf+bs+JH2Jgn+w==,iv:m3oKFJrByerC7/DPezR0j98Jsolqp8IOm67trL0zJwc=,tag:JAGhc5ts+QBO+DDttXgSVw==,type:str] - open_ai: ENC[AES256_GCM,data:zVXNbSHsux6JriiGW50+nApdnFZ88wO9pqIc/gOPf51zjKYPH8VZ0zNNXyE2McwZdWI7XqcNuUKFQdMZXl9sWZqfNV4cyrVXc4/XwRscv4yzY+PNKlHmCrI+s/rrqrnOkdMrpf68Vud0ifjuA+0c5YVeCWheSuc44S+XufG/ZxjIwFuQlxNn8pQvFsI3gDkc8UF1v+a0+Umh2fms5ybkOoTnEzFI04HlMak=,iv:CbZdq8QY413G8mwRiIstLrMM9tCIpw1J1pd7sGczSds=,tag:bga4kHU2AxqAtymi4EwXUw==,type:str] + open_ai: ENC[AES256_GCM,data:duAVK9S9gDz3XkzzP7b/mfUuOU+PEGTXXL9e7y8puhs1eJbaCTavKpdWeRJLlGZEDTW3KlyBl/WBcfSRrPEwIX4BOqiiYUin2TwTSyhsGIenUbka05CalBmq1T/H0Js=,iv:GP0Ug3Z0iWP8cpeFOyG6eyuovcfNs1K7/Q7CoNsZXZU=,tag:IH1NqrIksHBgRjpUv4sTLA==,type:str] sops: kms: - arn: arn:aws:kms:us-east-1:205083374951:key/d46e780d-ee0a-4a7d-b049-0443e1b91d41 @@ -17,8 +17,8 @@ sops: azure_kv: [] hc_vault: [] age: [] - lastmodified: "2024-10-07T19:35:37Z" - mac: ENC[AES256_GCM,data:dCiQ3NiH/4kqwVYLyk54SY1RzDffQMmbGx5diR2EyvktuqUpcRgx0TpUkMO4calsKwxv7ujffDpuo+CT2eNjt/b5Thuu6VUYqTr76jqeoyDWAZ4m0EA4q9Gz5Q4n1Y4FPEkhBAmaNfcWERV9zDOgTjdbG3IYEdKgKORHpSEUE4E=,iv:Rx966gFBzEdqynjMsaS5H+YiYDQjKm1IXQah8sK2+hk=,tag:YYVxK7SRk5YLkyJ5KdL0/g==,type:str] + lastmodified: "2024-10-08T14:44:56Z" + mac: ENC[AES256_GCM,data:lABCE3dB+TN7l0SB13j0/pEE++5wYiL7Hr7yC93S7q6ehFXpPQBXHzZnWJnFzW2+Qi774hR5C04jypCWpcrbNr6hb6l8EM27ssp1NJFC/SBGdPaLgUiiuJcHoCGfhF0T4VgaYZc/sATiYCyfvQn9h9W7+XkakCQyD5GVuqXf07c=,iv:gxeGlWZEtVHO68kAtdz7bJCNGzbcanUzqX73lYeDMwo=,tag:5z//KnPmKcWdWhc9yGBLNg==,type:str] pgp: [] unencrypted_suffix: _unencrypted version: 3.7.3 diff --git a/playbook-website/config/deploy/templates/deployment.yaml.erb b/playbook-website/config/deploy/templates/deployment.yaml.erb index 343681a9bf..a3220c1c94 100644 --- a/playbook-website/config/deploy/templates/deployment.yaml.erb +++ b/playbook-website/config/deploy/templates/deployment.yaml.erb @@ -50,6 +50,11 @@ spec: secretKeyRef: name: playbook key: sentry-dsn + - name: OPEN_AI + valueFrom: + secretKeyRef: + name: playbook + key: open-ai livenessProbe: httpGet: path: /health_check/site diff --git a/playbook-website/config/deploy/templates/secret.yaml.erb b/playbook-website/config/deploy/templates/secret.yaml.erb index 77b3f039ca..1110c51c2f 100644 --- a/playbook-website/config/deploy/templates/secret.yaml.erb +++ b/playbook-website/config/deploy/templates/secret.yaml.erb @@ -9,3 +9,4 @@ type: Opaque data: secret-key-base: <%= Base64.encode64(appConfig.fetch("secretKeyBase")).gsub("\n", "").strip %> sentry-dsn: <%= Base64.encode64(appConfig.fetch("sentry_dsn")).gsub("\n", "").strip %> + open-ai: <%= Base64.encode64(appConfig.fetch("open_ai")).gsub("\n", "").strip %> diff --git a/playbook-website/config/deploy/templates/shell.yaml.erb b/playbook-website/config/deploy/templates/shell.yaml.erb index 7f8f4d4717..8305c84094 100644 --- a/playbook-website/config/deploy/templates/shell.yaml.erb +++ b/playbook-website/config/deploy/templates/shell.yaml.erb @@ -41,6 +41,11 @@ template: value: "true" - name: RAILS_LOG_TO_STDOUT value: "true" + - name: OPEN_AI + valueFrom: + secretKeyRef: + name: playbook + key: open-ai resources: limits: cpu: 0.3 diff --git a/playbook-website/config/initializers/openai.rb b/playbook-website/config/initializers/openai.rb new file mode 100644 index 0000000000..457e6095b6 --- /dev/null +++ b/playbook-website/config/initializers/openai.rb @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +Rails.application.config.openai_api_key = ENV["OPENAI_API_KEY"]