mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
ecff88bd32
Summary: A new set of endpoints for managing installation and site configuration have been added: - GET `/api/install/configs/:key` - get the value of the configuration item with the specified key - PUT `/api/install/configs/:key` - set the value of the configuration item with the specified key - body: the JSON value of the configuration item - DELETE `/api/install/configs/:key` - delete the configuration item with the specified key - GET `/api/orgs/:oid/configs/:key` - get the value of the configuration item with the specified key - PUT `/api/orgs/:oid/configs/:key` - set the value of the configuration item with the specified key - body: the JSON value of the configuration item - DELETE `/api/orgs/:oid/configs/:key` - delete the configuration item with the specified key Configuration consists of key/value pairs, where keys are strings (e.g. `"audit_logs_streaming_destinations"`) and values are JSON, including literals like numbers and strings. Only installation admins and site owners are permitted to modify installation and site configuration, respectively. The endpoints are planned to be used in an upcoming feature for enabling audit log streaming for an installation and/or site. Future functionality may use the endpoints as well, which may require extending the current capabilities (e.g. adding support for storing secrets, additional metadata fields, etc.). Test Plan: Server tests Reviewers: paulfitz, jarek Reviewed By: paulfitz, jarek Subscribers: jarek Differential Revision: https://phab.getgrist.com/D4377
44 lines
985 B
TypeScript
44 lines
985 B
TypeScript
import { ConfigKey, ConfigValue } from "app/common/Config";
|
|
import { Organization } from "app/gen-server/entity/Organization";
|
|
import { nativeValues } from "app/gen-server/lib/values";
|
|
import {
|
|
BaseEntity,
|
|
Column,
|
|
CreateDateColumn,
|
|
Entity,
|
|
JoinColumn,
|
|
ManyToOne,
|
|
PrimaryGeneratedColumn,
|
|
UpdateDateColumn,
|
|
} from "typeorm";
|
|
|
|
@Entity({ name: "configs" })
|
|
export class Config extends BaseEntity {
|
|
@PrimaryGeneratedColumn()
|
|
public id: number;
|
|
|
|
@ManyToOne(() => Organization, { nullable: true })
|
|
@JoinColumn({ name: "org_id" })
|
|
public org: Organization | null;
|
|
|
|
@Column({ type: String })
|
|
public key: ConfigKey;
|
|
|
|
@Column({ type: nativeValues.jsonEntityType })
|
|
public value: ConfigValue;
|
|
|
|
@CreateDateColumn({
|
|
name: "created_at",
|
|
type: Date,
|
|
default: () => "CURRENT_TIMESTAMP",
|
|
})
|
|
public createdAt: Date;
|
|
|
|
@UpdateDateColumn({
|
|
name: "updated_at",
|
|
type: Date,
|
|
default: () => "CURRENT_TIMESTAMP",
|
|
})
|
|
public updatedAt: Date;
|
|
}
|