在iOS上使用edgeSDK包装器部署微服务时,imagePath和apiRootUrl的值是什么?如何设置它们?
我正在开发一个iOS应用程序,它使用基于duktape javascript的微服务,并将使用edgeSDK的iOS包装器进行部署。为了做到这一点,我被要求指定一个imagePath和apiRootUrl值。它们是什么?我如何设置它们 这是我的部署功能:在iOS上使用edgeSDK包装器部署微服务时,imagePath和apiRootUrl的值是什么?如何设置它们?,ios,swift,edgesdk,edgeengine,Ios,Swift,Edgesdk,Edgeengine,我正在开发一个iOS应用程序,它使用基于duktape javascript的微服务,并将使用edgeSDK的iOS包装器进行部署。为了做到这一点,我被要求指定一个imagePath和apiRootUrl值。它们是什么?我如何设置它们 这是我的部署功能: func deployMicroService() -> Void { let deployConfig = MMKMicroserviceDeploymentConfig.init(name: "micro-service",
func deployMicroService() -> Void {
let deployConfig = MMKMicroserviceDeploymentConfig.init(name: "micro-service", apiRootUrl: "???", imagePath: "???", envVariables: [:])
let edgeOpsWrapper = edgeSDK_iOS_app_ops()
edgeOpsWrapper.deployMicroservice(edgeAccessToken: "MY-DEPLOYMENT-TOKEN", config: deployConfig) { (result) in
if let checkedError = result.error {
print("micro service deployment ended with error: \(checkedError.localizedDescription)")
}
else {
print("micro service deployment result: \(result.status.debugDescription)")
}
}
}
答案是:
apiRootUrl是一个任意值,您的微服务将根据该值进行部署。例如,您可以使用以下内容:
"/micro-service/v1"
class func microServiceBundleStoragePath(serviceName: String) -> String? {
let microServiceFileName = "\(serviceName)-v1"
let microServiceBundlePath = Bundle.main.path(forResource: microServiceFileName, ofType: ".tar")
return microServiceBundlePath
}
这将导致您的micro服务可以在以下位置访问:
http://localhost:8087/client-id-value/micro-service/v1
imagePath是指向微服务映像tar文件的文件系统路径。通常位于应用程序包中。例如,您可以使用以下内容:
"/micro-service/v1"
class func microServiceBundleStoragePath(serviceName: String) -> String? {
let microServiceFileName = "\(serviceName)-v1"
let microServiceBundlePath = Bundle.main.path(forResource: microServiceFileName, ofType: ".tar")
return microServiceBundlePath
}
导致文件系统路径为:
"/private/var/containers/Bundle/Application/DF2F6617-9153-4AEC-999D-BC7699A80FA0/example.app/micro-service-v1.tar"
答案是:
apiRootUrl是一个任意值,您的微服务将根据该值进行部署。例如,您可以使用以下内容:
"/micro-service/v1"
class func microServiceBundleStoragePath(serviceName: String) -> String? {
let microServiceFileName = "\(serviceName)-v1"
let microServiceBundlePath = Bundle.main.path(forResource: microServiceFileName, ofType: ".tar")
return microServiceBundlePath
}
这将导致您的micro服务可以在以下位置访问:
http://localhost:8087/client-id-value/micro-service/v1
imagePath是指向微服务映像tar文件的文件系统路径。通常位于应用程序包中。例如,您可以使用以下内容:
"/micro-service/v1"
class func microServiceBundleStoragePath(serviceName: String) -> String? {
let microServiceFileName = "\(serviceName)-v1"
let microServiceBundlePath = Bundle.main.path(forResource: microServiceFileName, ofType: ".tar")
return microServiceBundlePath
}
导致文件系统路径为:
"/private/var/containers/Bundle/Application/DF2F6617-9153-4AEC-999D-BC7699A80FA0/example.app/micro-service-v1.tar"