Bind stove API keys to configured client IP
This commit is contained in:
@@ -153,6 +153,7 @@ CREATE TABLE IF NOT EXISTS stove_api_keys (
|
||||
revoked_at TEXT,
|
||||
created_at TEXT NOT NULL,
|
||||
note TEXT NOT NULL DEFAULT '',
|
||||
allowed_ip TEXT,
|
||||
history_bytes INTEGER NOT NULL DEFAULT 0,
|
||||
last_used_at TEXT
|
||||
);
|
||||
@@ -279,6 +280,8 @@ def init_db():
|
||||
with _conn() as conn:
|
||||
conn.executescript(_CREATE)
|
||||
conn.executescript(_STOVE_CREATE)
|
||||
if _колонки_нет(conn, "stove_api_keys", "allowed_ip"):
|
||||
conn.execute("ALTER TABLE stove_api_keys ADD COLUMN allowed_ip TEXT")
|
||||
for _col, _decl in (("category", "TEXT"), ("source", "TEXT"),
|
||||
("status", "TEXT NOT NULL DEFAULT 'new'")):
|
||||
if _колонки_нет(conn, "feedback", _col):
|
||||
|
||||
Reference in New Issue
Block a user