This commit is contained in:
Mirai Kumiko 2025-06-30 14:03:57 +02:00
parent fa350aa551
commit c531beadb7
Signed by: miraikumiko
GPG key ID: 3F178B1B5E0CB278
11 changed files with 20 additions and 41 deletions

View file

@ -6,7 +6,6 @@ defmodule Nulla.Repo.Migrations.CreateInstanceSettings do
add :id, :integer, primary_key: true
add :name, :string, default: "Nulla", null: false
add :description, :text, default: "Freedom Social Network", null: false
add :domain, :string, default: "localhost", null: false
add :registration, :boolean, default: false, null: false
add :max_characters, :integer, default: 5000, null: false
add :max_upload_size, :integer, default: 50, null: false
@ -25,20 +24,15 @@ defmodule Nulla.Repo.Migrations.CreateInstanceSettings do
{public_key, private_key} = Nulla.KeyGen.gen()
now = DateTime.utc_now()
domain =
Application.get_env(:nulla, NullaWeb.Endpoint, [])
|> Keyword.get(:url, [])
|> Keyword.get(:host, "localhost")
esc = fn str -> "'#{String.replace(str, "'", "''")}'" end
sql = """
INSERT INTO instance_settings (
id, name, description, domain, registration,
id, name, description, registration,
max_characters, max_upload_size, api_limit,
public_key, private_key, inserted_at, updated_at
) VALUES (
1, 'Nulla', 'Freedom Social Network', '#{domain}', false,
1, 'Nulla', 'Freedom Social Network', false,
5000, 50, 100,
#{esc.(public_key)}, #{esc.(private_key)},
'#{now}', '#{now}'