|
@@ -24,6 +24,7 @@ export class Stack {
|
|
protected _status: number = UNKNOWN;
|
|
protected _status: number = UNKNOWN;
|
|
protected _composeYAML?: string;
|
|
protected _composeYAML?: string;
|
|
protected _configFilePath?: string;
|
|
protected _configFilePath?: string;
|
|
|
|
+ protected _composeFileName: string = "compose.yaml";
|
|
protected server: DockgeServer;
|
|
protected server: DockgeServer;
|
|
|
|
|
|
protected combinedTerminal? : Terminal;
|
|
protected combinedTerminal? : Terminal;
|
|
@@ -34,6 +35,15 @@ export class Stack {
|
|
this.name = name;
|
|
this.name = name;
|
|
this.server = server;
|
|
this.server = server;
|
|
this._composeYAML = composeYAML;
|
|
this._composeYAML = composeYAML;
|
|
|
|
+
|
|
|
|
+ // Check if compose file name is different from compose.yaml
|
|
|
|
+ if (fs.existsSync(path.join(this.path, "compose.yml"))){
|
|
|
|
+ this._composeFileName = "compose.yml";
|
|
|
|
+ } else if (fs.existsSync(path.join(this.path, "docker-compose.yml"))){
|
|
|
|
+ this._composeFileName = "docker-compose.yml";
|
|
|
|
+ } else if (fs.existsSync(path.join(this.path, "docker-compose.yaml"))){
|
|
|
|
+ this._composeFileName = "docker-compose.yaml";
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
toJSON() : object {
|
|
toJSON() : object {
|
|
@@ -50,6 +60,7 @@ export class Stack {
|
|
status: this._status,
|
|
status: this._status,
|
|
tags: [],
|
|
tags: [],
|
|
isManagedByDockge: this.isManagedByDockge,
|
|
isManagedByDockge: this.isManagedByDockge,
|
|
|
|
+ composeFileName: this._composeFileName,
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
@@ -84,7 +95,7 @@ export class Stack {
|
|
get composeYAML() : string {
|
|
get composeYAML() : string {
|
|
if (this._composeYAML === undefined) {
|
|
if (this._composeYAML === undefined) {
|
|
try {
|
|
try {
|
|
- this._composeYAML = fs.readFileSync(path.join(this.path, "compose.yaml"), "utf-8");
|
|
|
|
|
|
+ this._composeYAML = fs.readFileSync(path.join(this.path, this._composeFileName), "utf-8");
|
|
} catch (e) {
|
|
} catch (e) {
|
|
this._composeYAML = "";
|
|
this._composeYAML = "";
|
|
}
|
|
}
|
|
@@ -135,7 +146,7 @@ export class Stack {
|
|
}
|
|
}
|
|
|
|
|
|
// Write or overwrite the compose.yaml
|
|
// Write or overwrite the compose.yaml
|
|
- fs.writeFileSync(path.join(dir, "compose.yaml"), this.composeYAML);
|
|
|
|
|
|
+ fs.writeFileSync(path.join(dir, this._composeFileName), this.composeYAML);
|
|
}
|
|
}
|
|
|
|
|
|
async deploy(socket? : DockgeSocket) : Promise<number> {
|
|
async deploy(socket? : DockgeSocket) : Promise<number> {
|