mount update api.

This commit is contained in:
Miroslav Šedivý
2021-05-19 22:22:49 +02:00
parent 888f625939
commit 40931e8fb1
5 changed files with 48 additions and 4 deletions
+14
View File
@@ -243,6 +243,16 @@ components:
format: datetime
example: "2021-03-07T21:56:34Z"
RoomMount:
type: object
properties:
host_path:
type: string
example: /profile
container_path:
type: string
example: /home/neko/.config/chromium
RoomSettings:
type: object
properties:
@@ -291,6 +301,10 @@ components:
type: string
example:
CUSTOM_ENV: custom value
mounts:
type: array
items:
$ref: '#/components/schemas/RoomMount'
RoomStats:
type: object
+1 -1
View File
@@ -1 +1 @@
5.1.1-SNAPSHOT
5.2.0-SNAPSHOT
+25
View File
@@ -107,6 +107,25 @@ export interface RoomMember {
*/
muted?: boolean;
}
/**
*
* @export
* @interface RoomMount
*/
export interface RoomMount {
/**
*
* @type {string}
* @memberof RoomMount
*/
host_path?: string;
/**
*
* @type {string}
* @memberof RoomMount
*/
container_path?: string;
}
/**
*
* @export
@@ -203,6 +222,12 @@ export interface RoomSettings {
* @memberof RoomSettings
*/
envs?: { [key: string]: string; };
/**
*
* @type {Array<RoomMount>}
* @memberof RoomSettings
*/
mounts?: Array<RoomMount>;
}
/**
*
+2 -2
View File
@@ -179,11 +179,11 @@ func (manager *RoomManagerCtx) Create(settings types.RoomSettings) (string, erro
}
binds := []string{}
for hostPath, containerPath := range settings.Mounts {
for _, mount := range settings.Mounts {
binds = append(
binds,
// TODO: Check for invalid paths.
path.Join(manager.config.InstanceData, roomName, hostPath)+":"+containerPath,
path.Join(manager.config.InstanceData, roomName, mount.HostPath)+":"+mount.ContainerPath,
)
}
+6 -1
View File
@@ -39,6 +39,11 @@ type RoomEntry struct {
Created time.Time `json:"created"`
}
type RoomMount struct {
HostPath string `json:"host_path"`
ContainerPath string `json:"container_path"`
}
type RoomSettings struct {
Name string `json:"name"`
NekoImage string `json:"neko_image"`
@@ -60,7 +65,7 @@ type RoomSettings struct {
BroadcastPipeline string `json:"broadcast_pipeline,omitempty"`
Envs map[string]string `json:"envs"`
Mounts map[string]string `json:"mounts"`
Mounts []RoomMount `json:"mounts"`
}
func (settings *RoomSettings) ToEnv() []string {