refactor: migrate to new configuration system and model definitions

This commit is contained in:
Prad Nukala
2024-12-11 12:21:52 -05:00
parent 40f50bf37a
commit 0502f52ec0
54 changed files with 154 additions and 443 deletions
+18
View File
@@ -0,0 +1,18 @@
@go.Package { name = "github.com/onsonr/sonr/pkg/config/hway" }
open module sonr.conf.Hway
import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
servePort: Int = 3000
configDir: String = "~/.config/hway"
sqliteFile: String = "hway.db"
chainId: String = "sonr-testnet-1"
ipfsGatewayUrl: String = "http://localhost:8080"
sonrApiUrl: String = "http://localhost:1317"
sonrGrpcUrl: String = "http://localhost:9090"
sonrRpcUrl: String = "http://localhost:26657"
+81
View File
@@ -0,0 +1,81 @@
@go.Package { name = "github.com/onsonr/sonr/pkg/config/motr" }
module sonr.conf.Motr
import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
typealias JSON = String
class JsonField extends go.Field {
structTags {
["json"] = "%{name},omitempty"
}
}
class Config {
@JsonField
ipfsGatewayUrl: String
@JsonField
motrToken: String
@JsonField
motrAddress: String
@JsonField
sonrApiUrl: String
@JsonField
sonrRpcUrl: String
@JsonField
sonrChainId: String
@JsonField
vaultSchema: Schema
}
class Environment {
@JsonField
isDevelopment: Boolean
@JsonField
cacheVersion: String
@JsonField
httpserverPath: String
@JsonField
wasmExecPath: String
@JsonField
wasmPath: String
}
class Schema {
version: Int
@JsonField
account: String
@JsonField
asset: String
@JsonField
chain: String
@JsonField
credential: String
@JsonField
jwk: String
@JsonField
grant: String
@JsonField
keyshare: String
@JsonField
profile: String
}
+22
View File
@@ -0,0 +1,22 @@
//===----------------------------------------------------------------------===//
// Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//===----------------------------------------------------------------------===//
/// Common types for operations across the sonr ecosystem
amends "../basePklProject.pkl"
package {
name = "sonr.conf"
version = "0.0.1"
}
+4
View File
@@ -0,0 +1,4 @@
{
"schemaVersion": 1,
"resolvedDependencies": {}
}