From e4324ac3f346e1e4b8d4d16e6a82013f25d60578 Mon Sep 17 00:00:00 2001 From: Robert Prehn <3952444+prehnRA@users.noreply.github.com> Date: Thu, 6 May 2021 12:21:32 -0500 Subject: [PATCH 1/4] fix: Read live view signing salt from env var --- config/prod.exs | 3 ++- infrastructure_templates/kube.yaml.dot | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/config/prod.exs b/config/prod.exs index 4bc1d701..62f7f1d2 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -11,6 +11,7 @@ use Mix.Config # before starting your production server. secret_key_base = System.get_env("SECRET_KEY_BASE") +signing_salt = System.get_env("LIVE_VIEW_SIGNING_SALT") [ {:admin, Legendary.Admin, false}, @@ -35,7 +36,7 @@ secret_key_base = System.get_env("SECRET_KEY_BASE") ], secret_key_base: secret_key_base, pubsub_server: App.PubSub, - live_view: [signing_salt: "g5ltUbnQ"], + live_view: [signing_salt: signing_salt], server: start_server ] ++ extra_opts end) diff --git a/infrastructure_templates/kube.yaml.dot b/infrastructure_templates/kube.yaml.dot index df236d74..eeeeb67d 100644 --- a/infrastructure_templates/kube.yaml.dot +++ b/infrastructure_templates/kube.yaml.dot @@ -34,6 +34,12 @@ spec: secretKeyRef: name: legendary key: secret-key-base + - name: SECRET_KEY_BASE + - name: LIVE_VIEW_SIGNING_SALT + valueFrom: + secretKeyRef: + name: legendary + key: live-view-signing-salt --- apiVersion: v1 kind: Service From 1f8bdba4cad71614eee7875bc593a1e25cf66363 Mon Sep 17 00:00:00 2001 From: Robert Prehn <3952444+prehnRA@users.noreply.github.com> Date: Thu, 6 May 2021 12:21:58 -0500 Subject: [PATCH 2/4] chore: Clarify guides --- apps/core/guides/features/i18n.md | 17 ++++++++++++++++- apps/core/guides/overview.md | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/apps/core/guides/features/i18n.md b/apps/core/guides/features/i18n.md index dbdb29b1..e4d7cc00 100644 --- a/apps/core/guides/features/i18n.md +++ b/apps/core/guides/features/i18n.md @@ -8,7 +8,7 @@ allows non-developers on a team to make copy changes. 2. When your application supports multiple languages, it is easy for translators to provide translations for all of your copy at once. -In Legendary, we provide a set of tools for doing this. +In Legendary, we provide a set of tools for doing this via [linguist](https://github.com/change/linguist). - (English) strings are stored in config/i18n/en.yml. - You can call `Legendary.I18n.t!/2` to get a string by its key. For example: `Legendary.I18n.t! "en", "site.title"` retrieves the english version of the @@ -20,5 +20,20 @@ string labeled "title" under the section "site" on en.yml. Note that the first argument is a two-letter language code. In order to support other languages, you can provide more yml files in config/i18n (example, config/i18n/fr.yml for French) and call t!/2 with that language code instead. +Linguist also supports templated translations. If you have a section in en.yml like this: + +```yaml +app: + hello_message: Hello, %{name}! +``` + +then you could call `t!` substitutions like this: + +```elixir +t! "en", "app.hello_message", name: "Legend" +``` + +to get the string "Hello, legend!" + **On the roadmap:** in the future, we intend to provide a mechanism for detecting and managing each visitor's language and providing those strings if available. diff --git a/apps/core/guides/overview.md b/apps/core/guides/overview.md index 30f64e32..2aa36949 100644 --- a/apps/core/guides/overview.md +++ b/apps/core/guides/overview.md @@ -27,7 +27,7 @@ Since Legendary is both a template and a framework, you can simply clone the rep to start using it. It's a fully functional Phoenix app as-is. To start a new project: ```sh -git clone git@gitlab.com:mythic-insight/legendary.git +git clone https://gitlab.com/mythic-insight/legendary.git ``` In order to start the server, run `script/server`. Any dependencies required From 57218a5cb20062a8a805a8c47fba868ae82b05e3 Mon Sep 17 00:00:00 2001 From: Robert Prehn <3952444+prehnRA@users.noreply.github.com> Date: Thu, 6 May 2021 12:22:22 -0500 Subject: [PATCH 3/4] fix: Use which asdf in bootstrap instead of asdf -v --- script/bootstrap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/bootstrap b/script/bootstrap index 91aaf9b5..355d748f 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -12,7 +12,7 @@ else export KERL_CONFIGURE_OPTIONS="--disable-hipe --with-ssl=$(brew --prefix openssl)" fi -if ! asdf -v &> /dev/null +if ! which asdf &> /dev/null then echo "WARNING: No asdf. Skipping erlang, elixir, node installation." else @@ -27,4 +27,4 @@ else asdf install fi -mix local.hex --force +mix local.hex --force From 53169c8fa2f03ea67b3404b77fcfe2decb6595b0 Mon Sep 17 00:00:00 2001 From: Robert Prehn <3952444+prehnRA@users.noreply.github.com> Date: Thu, 6 May 2021 12:25:05 -0500 Subject: [PATCH 4/4] fix: Remove erroneous line in kube.yaml.dot --- infrastructure_templates/kube.yaml.dot | 1 - 1 file changed, 1 deletion(-) diff --git a/infrastructure_templates/kube.yaml.dot b/infrastructure_templates/kube.yaml.dot index eeeeb67d..d027c073 100644 --- a/infrastructure_templates/kube.yaml.dot +++ b/infrastructure_templates/kube.yaml.dot @@ -34,7 +34,6 @@ spec: secretKeyRef: name: legendary key: secret-key-base - - name: SECRET_KEY_BASE - name: LIVE_VIEW_SIGNING_SALT valueFrom: secretKeyRef: