diff --git a/.gitignore b/.gitignore index 25dfd5a..edc238d 100644 --- a/.gitignore +++ b/.gitignore @@ -14,5 +14,4 @@ # Dependency directories (remove the comment below to include it) # vendor/ -dist/ -resources/webui +dist/ \ No newline at end of file diff --git a/client/main.go b/cmd/client/main.go similarity index 100% rename from client/main.go rename to cmd/client/main.go diff --git a/main/main.go b/cmd/saturn-l2/main.go similarity index 87% rename from main/main.go rename to cmd/saturn-l2/main.go index 19a185e..388b415 100644 --- a/main/main.go +++ b/cmd/saturn-l2/main.go @@ -31,15 +31,25 @@ import ( ) const ( - PORT_ENV_VAR = "PORT" - FIL_ADDRESS_VAR = "FIL_WALLET_ADDRESS" - MAX_DISK_SPACE_VAR = "MAX_DISK_SPACE" - IPFS_GATEWAY_BASE_URL = "https://ipfs.io/api/v0/dag/export" - ROOT_DIR_ENV_VAR = "ROOT_DIR" + // PORT_ENV_VAR is the environment variable that determines the port the saturn L2 service will bind to. + // If this environment variable is not configured, this service will bind to any available port. + PORT_ENV_VAR = "PORT_ENV" + + // ROOT_DIR_ENV_VAR is the environment variable that determines the root directory of the Saturn L2 Node. + // All persistent state and cached CAR files will be persisted under this directory. + // Mandatory environment variable -> no default for now. + ROOT_DIR_ENV_VAR = "ROOT_DIR_ENV" + + // MAX_DISK_SPACE_VAR configures the environment variable that determines the maximum disk space the L2 node can use to + // store cached CAR files. If this env variable is not configured, it defaults to 200GiB. + MAX_DISK_SPACE_VAR = "MAX_L2_DISK_SPACE_ENV" + + FIL_ADDRESS_VAR = "FIL_WALLET_ADDRESS_ENV" ) var ( - defaultMaxSize = uint64(200 * 1073741824) // 200 Gib + gateway_base_url = "https://ipfs.io/api/v0/dag/export" + defaultMaxSize = uint64(200 * 1073741824) // 200 Gib ) type config struct { @@ -112,8 +122,7 @@ func main() { os.Exit(4) } - - port = nl.Addr().(*net.TCPAddr).Port + port := nl.Addr().(*net.TCPAddr).Port fmt.Println("Server listening on", nl.Addr()) fmt.Printf("WebUI: http://localhost:%d/webui\n", port) @@ -196,7 +205,7 @@ func buildCarServer(cfg config) (*CARServer, error) { } sapi := carserver.NewStationAPIImpl(dss, nil) - gwApi := carstore.NewGatewayAPI(IPFS_GATEWAY_BASE_URL, sapi) + gwApi := carstore.NewGatewayAPI(gateway_base_url, sapi) carStoreConfig := carstore.Config{ MaxCARFilesDiskSpace: int64(cfg.MaxDiskSpace), } diff --git a/resources/webui/package-lock.json b/resources/webui/package-lock.json new file mode 100644 index 0000000..cd60de0 --- /dev/null +++ b/resources/webui/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "webui", + "lockfileVersion": 2, + "requires": true, + "packages": {} +} diff --git a/resources/webui/saturn-webui b/resources/webui/saturn-webui new file mode 160000 index 0000000..07409a5 --- /dev/null +++ b/resources/webui/saturn-webui @@ -0,0 +1 @@ +Subproject commit 07409a5fd3b682b12c908ab7ead17c0fd817e652