package com.fdkankan.fyun.constant;

import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class FYunConstants {

    @Value("${fyun.shell.path:/opt/ossutil}")
    public String shellPath;

    /**
     * oss文件上传命令 bash /opt/ossutil/fyun-upload.sh {bucket} {srcPath} {destPath} {fyunType} {opType}
     * opType: file or folder
     * 参考：http://showdoc.4dage.com/web/#/45?page_id=784
     * 例：下载目录：bash /opt/ossutil/fyun-download.sh 4dkankan /home/XXX /mnt/XXX oss folder
     */
    public String UPLOAD_SH;
    public String DOWNLOAD_SH;

    @PostConstruct
    public void initSh(){
        this.UPLOAD_SH = "sudo bash ".concat(shellPath).concat("/fyun-upload.sh %s %s /%s %s %s");
        this.DOWNLOAD_SH = "sudo bash ".concat(shellPath).concat("/fyun-download.sh %s /%s %s %s %s");
    }
}
