-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Для некоторых Relation сделать возможность создания отдельных классов
class YamlFile extends Relation
{
/**
* Before save item
*/
Dict onBeforeSave(Dict d)
{
if (this.isNew())
{
this.set("gmtime_created", DateTime::now());
}
this.set("gmtime_updated", DateTime::now());
return d;
}
/**
* Compose yaml file
*/
async void compose()
{
/* Save file */
await this.saveFile();
string file_path = "/data/yaml/" ~ this.get("stack_name") ~ "/" ~ this.get("file_name");
string result = await DockerApi::compose(file_path, this.get("stack_name"));
return result;
}
/**
* Save yaml file on drive
*/
async void saveFile()
{
string file_path = "/data/yaml/" ~ this.get("stack_name") ~ "/" ~ this.get("file_name");
string file_dirname = rs::dirname(file_path);
string content = this.get("content");
await fs::mkdir(file_dirname);
await fs::saveFile(file_path, content);
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels