mirror of
https://github.com/fluencelabs/aqua.git
synced 2025-04-24 22:42:13 +00:00
Dist bug fixes (#422)
This commit is contained in:
parent
6d03a0d95b
commit
88da133e00
19
cli/.js/src/main/scala/aqua/dist/DistOpts.scala
vendored
19
cli/.js/src/main/scala/aqua/dist/DistOpts.scala
vendored
@ -1,10 +1,10 @@
|
||||
package aqua.dist
|
||||
|
||||
import aqua.builder.IPFSUploader
|
||||
import aqua.builder.{ArgumentGetter, IPFSUploader}
|
||||
import aqua.files.AquaFilesIO
|
||||
import aqua.io.OutputPrinter
|
||||
import aqua.ipfs.js.IpfsApi
|
||||
import aqua.js.{Fluence, PeerConfig}
|
||||
import aqua.js.{Config, Fluence, PeerConfig}
|
||||
import aqua.keypair.KeyPairShow.show
|
||||
import aqua.model.LiteralModel
|
||||
import aqua.raw.value.{LiteralRaw, VarRaw}
|
||||
@ -49,6 +49,12 @@ object DistOpts extends Logging {
|
||||
Opts.subcommand(deploy)
|
||||
}
|
||||
|
||||
def fillConfigOptionalFields(getter: ArgumentGetter): ArgumentGetter = {
|
||||
val arg = getter.function.arg
|
||||
val filledConfig = Config.fillWithEmptyArrays(arg)
|
||||
ArgumentGetter(getter.function.value, filledConfig)
|
||||
}
|
||||
|
||||
// Uploads a file to IPFS
|
||||
def deploy[F[_]: Async](implicit ec: ExecutionContext): Command[F[ExitCode]] =
|
||||
Command(
|
||||
@ -66,13 +72,18 @@ object DistOpts extends Logging {
|
||||
dff
|
||||
.andThen(data =>
|
||||
checkDataGetServices(args, data).map(getServices =>
|
||||
// TODO: delete this another dirty hack
|
||||
// if we have default timeout, increase it
|
||||
val commonWithTimeout = if (common.timeout == 14000) {
|
||||
common.copy(timeout = 60000)
|
||||
} else common
|
||||
RunOpts.execRun(
|
||||
common,
|
||||
commonWithTimeout,
|
||||
DeployFuncName,
|
||||
distAquaPath,
|
||||
Nil,
|
||||
args,
|
||||
getServices,
|
||||
getServices.map { (k, v) => (k, fillConfigOptionalFields(v)) },
|
||||
Nil
|
||||
)
|
||||
)
|
||||
|
13
cli/.js/src/main/scala/aqua/js/Config.scala
Normal file
13
cli/.js/src/main/scala/aqua/js/Config.scala
Normal file
@ -0,0 +1,13 @@
|
||||
package aqua.js
|
||||
|
||||
import scala.scalajs.js
|
||||
import scala.scalajs.js.annotation.{JSExportAll, JSImport}
|
||||
|
||||
object Config {
|
||||
|
||||
@js.native
|
||||
@JSImport("./dist/config.js", "fillWithEmptyArrays")
|
||||
def fillWithEmptyArrays(
|
||||
config: js.Dynamic
|
||||
): js.Dynamic = js.native
|
||||
}
|
@ -11,7 +11,7 @@ object FluenceOpts {
|
||||
val timeoutOpt: Opts[Int] =
|
||||
Opts
|
||||
.option[Int]("timeout", "Request timeout in milliseconds", "t")
|
||||
.withDefault(7000)
|
||||
.withDefault(14000)
|
||||
|
||||
val multiaddrOpt: Opts[String] =
|
||||
Opts
|
||||
|
@ -73,6 +73,10 @@ func deploy(serviceConf: ServiceConf) -> string:
|
||||
|
||||
service_id <- Srv.create(blueprint_id)
|
||||
|
||||
Console.print("Blueprint id:")
|
||||
Console.print(blueprint_id)
|
||||
Console.print("And your service id is:")
|
||||
|
||||
<- service_id
|
||||
|
||||
func remove(service_id: string):
|
||||
|
33
npm/src/config.ts
Normal file
33
npm/src/config.ts
Normal file
@ -0,0 +1,33 @@
|
||||
|
||||
type Module = {
|
||||
name: string,
|
||||
path: string,
|
||||
mounted_binaries: string[][],
|
||||
logger_enabled: boolean[],
|
||||
preopened_files: string[],
|
||||
mapped_dirs: string[]
|
||||
}
|
||||
|
||||
type Config = {
|
||||
name: string,
|
||||
modules: Module[]
|
||||
}
|
||||
|
||||
export function fillWithEmptyArrays(config: Config): Config {
|
||||
config.modules = config.modules.map((m) => {
|
||||
if (!m.logger_enabled) {
|
||||
m.logger_enabled = []
|
||||
}
|
||||
if (!m.mounted_binaries) {
|
||||
m.mounted_binaries = []
|
||||
}
|
||||
if (!m.preopened_files) {
|
||||
m.preopened_files = []
|
||||
}
|
||||
if (!m.mapped_dirs) {
|
||||
m.mapped_dirs = []
|
||||
}
|
||||
return m
|
||||
})
|
||||
return config
|
||||
}
|
@ -1,8 +1,6 @@
|
||||
import {create, globSource} from "ipfs-http-client";
|
||||
import { Multiaddr, protocols } from "multiaddr";
|
||||
|
||||
import * as util from "util";
|
||||
|
||||
type UploadResult = {
|
||||
cid: string,
|
||||
size: number
|
||||
|
Loading…
x
Reference in New Issue
Block a user