This plugin for Kanta allows easily synchronizing translations from your dev/staging environment, directly into the production.
Add KantaSync plugin to your deps list:
def deps do
[
{:kanta_sync_plugin, "~> 0.1.0"}
]
end
Create a new migration file and add the KantaSync migrations setup:
defmodule KantaTest.Repo.Migrations.AddKantaSyncTables do
use Ecto.Migration
def up do
Kanta.Sync.Migration.up(version: 1)
end
def down do
Kanta.Sync.Migration.down(version: 1)
end
end
KantaSync plugin creates table kanta_sync_information
where information about the last fetch from the production is stored, to send only necessary changes instead of a full translations list when synchronizing.
Make sure that you have the Kanta API endpoint configured:
scope "/" do
kanta_api("/kanta-api")
end
KANTA_API_ENDPOINT
Full path to Kanta API endpoint. Example:KANTA_API_ENDPOINT=https://kanta.curiosum.com/kanta-api
KANTA_SECRET_TOKEN
Secret token allowing communication between production and staging/dev environments. Should be generated withmix phx.gen.secret 256
. Both environments must have the sameKANTA_SECRET_TOKEN
environment variables. You can also disable default authorization mechanism and use your own, by passingdisable_api_authorization: true
option into Kanta's config.