build endpoints
This commit is contained in:
@@ -11,9 +11,14 @@ class CreateWarpEngineTables < ActiveRecord::Migration[8.0]
|
||||
t.string :site
|
||||
t.string :status, limit: 20, default: "development"
|
||||
t.boolean :highlighted, default: false
|
||||
# A publikáló token ownere (enforce_software_ownership) — nem lehet FK,
|
||||
# az owner osztályát a host adja.
|
||||
t.string :owner_type, limit: 128
|
||||
t.bigint :owner_id
|
||||
t.datetime :deleted_at, precision: 3
|
||||
t.timestamps precision: 3, null: true
|
||||
t.index :name, unique: true
|
||||
t.index [ :owner_type, :owner_id ]
|
||||
t.index :deleted_at
|
||||
end
|
||||
|
||||
@@ -82,6 +87,8 @@ class CreateWarpEngineTables < ActiveRecord::Migration[8.0]
|
||||
t.string :token_digest, limit: 64, null: false
|
||||
t.string :token_prefix, limit: 12, null: false
|
||||
t.json :scopes
|
||||
# Belső token: az enforce_software_ownership nem vonatkozik rá.
|
||||
t.boolean :unrestricted, default: false, null: false
|
||||
t.datetime :expires_at, precision: 3
|
||||
t.datetime :last_used_at, precision: 3
|
||||
t.datetime :deleted_at, precision: 3
|
||||
|
||||
@@ -5,11 +5,11 @@ Rails.application.config.to_prepare do
|
||||
# c.file_container_path = "/softwares"
|
||||
# c.image_container_path = "/images"
|
||||
|
||||
# A /update endpoint shared secretje (default: ENV["UPDATE_SECRET"]).
|
||||
# Beállítatlan secret esetén az endpoint minden kérést elutasít.
|
||||
# A /build/* endpointok shared secretje (default: ENV["UPDATE_SECRET"]).
|
||||
# Beállítatlan secret esetén az endpointok minden kérést elutasítanak.
|
||||
# c.update_secret = ENV["UPDATE_SECRET"]
|
||||
|
||||
# A /update hitelesítési forrása — kizárólagos választás:
|
||||
# A /build/* hitelesítési forrása — kizárólagos választás:
|
||||
# :env — a fenti shared secret érvényes (default)
|
||||
# :database — csak DB-tárolt WarpEngine::ApplicationToken érvényes
|
||||
# ("update" scope-pal); a shared secret ilyenkor NEM működik.
|
||||
@@ -17,6 +17,14 @@ Rails.application.config.to_prepare do
|
||||
# c.application_token_source = :database
|
||||
# c.application_token_owner_class = "AdminUser"
|
||||
|
||||
# A /build/upload (és az admin file manager) méretplafonja bájtban (default: 500MB).
|
||||
# c.max_upload_size = 500 * 1024 * 1024
|
||||
|
||||
# Owner-izoláció: DB-token csak a saját ownerének szoftvereit
|
||||
# uploadolhatja/publisholhatja (unrestricted token kivétel). Csak azután
|
||||
# kapcsold be, hogy a meglévő szoftverek ownert kaptak (backfill)!
|
||||
# c.enforce_software_ownership = true
|
||||
|
||||
# Ha a host modelljei is hivatkoznak katalógus-képekre, regisztráld őket,
|
||||
# hogy az admin Images oldal orphan-detektálása figyelembe vegye:
|
||||
# c.image_owners = [
|
||||
|
||||
@@ -4,16 +4,22 @@ module WarpEngine
|
||||
# label: String
|
||||
# image_ids: -> { Array<Integer> } — az owner által használt image id-k
|
||||
# usage_label: ->(image) { String vagy nil } — megjelenítendő címke, ha használja
|
||||
# application_token_source: a /update endpoint hitelesítési forrása, kizárólagos.
|
||||
# application_token_source: a /build/* endpointok hitelesítési forrása, kizárólagos.
|
||||
# :env — a shared secret (update_secret) érvényes, a DB-tokenek nem
|
||||
# :database — csak WarpEngine::ApplicationToken érvényes, a shared secret nem
|
||||
# application_token_owner_class: a tokenek kötelező tulajdonosának osztályneve
|
||||
# (pl. "AdminUser"); nil esetén a :database mód minden kérést elutasít.
|
||||
# max_upload_size: a /build/upload (és az admin file manager) fájlméret-plafonja bájtban.
|
||||
# enforce_software_ownership: ha true, egy DB-token csak a saját ownerének
|
||||
# szoftvereit uploadolhatja/publisholhatja (unrestricted token kivétel).
|
||||
# Bekapcsolás CSAK backfill után: gazdátlan software-t bármely token elvihet.
|
||||
attr_accessor :file_container_path,
|
||||
:image_container_path,
|
||||
:update_secret,
|
||||
:application_token_source,
|
||||
:application_token_owner_class,
|
||||
:max_upload_size,
|
||||
:enforce_software_ownership,
|
||||
:image_owners
|
||||
|
||||
def initialize
|
||||
@@ -22,6 +28,8 @@ module WarpEngine
|
||||
@update_secret = ENV["UPDATE_SECRET"]
|
||||
@application_token_source = :env
|
||||
@application_token_owner_class = nil
|
||||
@max_upload_size = 500 * 1024 * 1024
|
||||
@enforce_software_ownership = false
|
||||
@image_owners = []
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user