Skip to content

Commit 89f3e2c

Browse files
committed
getting OASIS API working on Azure!
1 parent a7a013d commit 89f3e2c

8 files changed

Lines changed: 139 additions & 44 deletions

File tree

OASIS Architecture/NextGenSoftware.OASIS.API.Core/Managers/AvatarManager/AvatarManager-Private.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,11 @@ private async Task<OASISResult<IAvatar>> PrepareToRegisterAvatarAsync(string ava
177177
OASISErrorHandling.HandleError(ref result, $"Error occured creating default wallet for provider/chain {walletResult.Message}");
178178
}
179179

180-
OASISResult<bool> saveWalletsResult = await WalletManager.Instance.SaveProviderWalletsForAvatarByIdAsync(result.Result.Id, result.Result.ProviderWallets);
180+
//TODO: Fix this properly later! For some reason was causing an error in Azure cloud but seemed fine everywhere else including AWS etc! Its to do with not being able to save the wallets locally, which is not what we want on a server anyway! lol
181+
//OASISResult<bool> saveWalletsResult = await WalletManager.Instance.SaveProviderWalletsForAvatarByIdAsync(result.Result.Id, result.Result.ProviderWallets);
181182

182-
if (!(saveWalletsResult != null && saveWalletsResult.Result != null && !saveWalletsResult.IsError))
183-
OASISErrorHandling.HandleError(ref result, $"Error occured saving the default wallets. Reason: {saveWalletsResult.Message}");
183+
//if (!(saveWalletsResult != null && saveWalletsResult.Result != null && !saveWalletsResult.IsError))
184+
// OASISErrorHandling.HandleError(ref result, $"Error occured saving the default wallets. Reason: {saveWalletsResult.Message}");
184185

185186
result.Result.CreatedByAvatarId = result.Result.Id;
186187
OASISResult<bool> checkIfUsernameExistsResult = CheckIfUsernameIsAlreadyInUse(email);

OASIS Architecture/NextGenSoftware.OASIS.API.Core/Managers/AvatarManager/AvatarManager-Save.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ public partial class AvatarManager : OASISManager
1313
{
1414
public async Task<OASISResult<IAvatar>> SaveAvatarAsync(IAvatar avatar, AutoReplicationMode autoReplicationMode = AutoReplicationMode.UseGlobalDefaultInOASISDNA, AutoFailOverMode autoFailOverMode = AutoFailOverMode.UseGlobalDefaultInOASISDNA, AutoLoadBalanceMode autoLoadBalanceMode = AutoLoadBalanceMode.UseGlobalDefaultInOASISDNA, bool waitForAutoReplicationResult = false, ProviderType providerType = ProviderType.Default)
1515
{
16+
Console.WriteLine($"CurrentDirectory: {Environment.CurrentDirectory}");
17+
Console.WriteLine($"BaseDirectory: {AppContext.BaseDirectory}");
18+
Console.WriteLine($"DNA Path being used: {OASISDNAManager.OASISDNAPath}");
19+
Console.WriteLine($"AppRootDirectory: {AppPathHelper.ResolveAppRootDirectory()}");
20+
1621
if (avatar == null)
1722
return new OASISResult<IAvatar> { IsError = true, Message = "The avatar is required. Please provide a valid avatar object." };
1823
// HyperDrive v2 routing with safe fallback to legacy
@@ -106,7 +111,7 @@ public async Task<OASISResult<IAvatar>> SaveAvatarAsync(IAvatar avatar, AutoRepl
106111
}
107112
catch (Exception ex)
108113
{
109-
OASISErrorHandling.HandleError(ref result, string.Concat("Unknown error occured saving avatar ", avatar.Name, " with id ", avatar.Id, " for provider ", ProviderManager.Instance.CurrentStorageProviderType.Name), string.Concat("Error Message: ", ex.Message), ex);
114+
OASISErrorHandling.HandleError(ref result, string.Concat("Unknown error occured: ", ex.ToString(), " saving avatar ", avatar.Name, " with id ", avatar.Id, " for provider ", ProviderManager.Instance.CurrentStorageProviderType.Name), string.Concat("Error Message: ", ex.Message), ex);
110115
result.Result = null;
111116
}
112117

OASIS Architecture/NextGenSoftware.OASIS.API.Core/Managers/WalletManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2896,7 +2896,7 @@ public OASISResult<bool> SaveProviderWalletsForAvatarById(Guid id, Dictionary<Pr
28962896

28972897
try
28982898
{
2899-
providerType = ProviderType.LocalFileOASIS; //TODO: TEMP!
2899+
//providerType = ProviderType.LocalFileOASIS; //TODO: TEMP!
29002900
OASISResult<IOASISStorageProvider> providerResult = ProviderManager.Instance.SetAndActivateCurrentStorageProvider(providerType);
29012901
errorMessage = string.Format(errorMessageTemplate, ProviderManager.Instance.CurrentStorageProviderType.Name);
29022902

@@ -2967,7 +2967,7 @@ public async Task<OASISResult<bool>> SaveProviderWalletsForAvatarByIdAsync(Guid
29672967

29682968
try
29692969
{
2970-
providerType = ProviderType.LocalFileOASIS; //TODO:Temp!
2970+
//providerType = ProviderType.LocalFileOASIS; //TODO:Temp!
29712971

29722972
CLIEngine.SupressConsoleLogging = true;
29732973
OASISResult<IOASISStorageProvider> providerResult = await ProviderManager.Instance.SetAndActivateCurrentStorageProviderAsync(providerType);

OASIS Architecture/NextGenSoftware.OASIS.OASISBootLoader/OASISBootLoader.cs

Lines changed: 56 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,55 @@
1-
using System;
2-
using System.Numerics;
3-
using System.Threading.Tasks;
4-
using System.Collections.Generic;
1+
//using NextGenSoftware.OASIS.API.Providers.TONOASIS; // Not referenced in Core Only solution
2+
//using NextGenSoftware.OASIS.API.Providers.ZkSyncOASIS;
3+
//using NextGenSoftware.OASIS.API.Providers.LineaOASIS;
4+
//using NextGenSoftware.OASIS.API.Providers.ScrollOASIS;
5+
//using NextGenSoftware.OASIS.API.Providers.XRPLOASIS;
6+
using NextGenSoftware.CLI.Engine;
57
using NextGenSoftware.Logging;
68
using NextGenSoftware.Logging.NLogger;
7-
using NextGenSoftware.OASIS.Common;
8-
using NextGenSoftware.OASIS.API.DNA;
99
using NextGenSoftware.OASIS.API.Core.Enums;
10+
using NextGenSoftware.OASIS.API.Core.Helpers;
1011
using NextGenSoftware.OASIS.API.Core.Interfaces;
1112
using NextGenSoftware.OASIS.API.Core.Managers;
12-
using NextGenSoftware.OASIS.API.Core.Helpers;
13+
using NextGenSoftware.OASIS.API.DNA;
14+
using NextGenSoftware.OASIS.API.Providers.ActivityPubOASIS;
15+
using NextGenSoftware.OASIS.API.Providers.AptosOASIS;
16+
using NextGenSoftware.OASIS.API.Providers.ArbitrumOASIS;
17+
using NextGenSoftware.OASIS.API.Providers.AvalancheOASIS;
1318
using NextGenSoftware.OASIS.API.Providers.AzureCosmosDBOASIS;
19+
using NextGenSoftware.OASIS.API.Providers.BaseOASIS;
20+
using NextGenSoftware.OASIS.API.Providers.BitcoinOASIS;
21+
using NextGenSoftware.OASIS.API.Providers.BNBChainOASIS;
22+
using NextGenSoftware.OASIS.API.Providers.CardanoOASIS;
23+
using NextGenSoftware.OASIS.API.Providers.ChainLinkOASIS;
24+
using NextGenSoftware.OASIS.API.Providers.CosmosBlockChainOASIS;
1425
using NextGenSoftware.OASIS.API.Providers.EOSIOOASIS;
15-
using NextGenSoftware.OASIS.API.Providers.TelosOASIS;
16-
using NextGenSoftware.OASIS.API.Providers.SEEDSOASIS;
26+
using NextGenSoftware.OASIS.API.Providers.EthereumOASIS;
27+
using NextGenSoftware.OASIS.API.Providers.FantomOASIS;
28+
using NextGenSoftware.OASIS.API.Providers.GoogleCloudOASIS;
29+
using NextGenSoftware.OASIS.API.Providers.HashgraphOASIS;
1730
using NextGenSoftware.OASIS.API.Providers.HoloOASIS;
18-
using NextGenSoftware.OASIS.API.Providers.MongoDBOASIS;
19-
using NextGenSoftware.OASIS.API.Providers.SQLLiteDBOASIS;
2031
using NextGenSoftware.OASIS.API.Providers.IPFSOASIS;
21-
using NextGenSoftware.OASIS.API.Providers.PinataOASIS;
22-
using NextGenSoftware.OASIS.API.Providers.Neo4jOASIS.Aura;
23-
using NextGenSoftware.OASIS.API.Providers.EthereumOASIS;
24-
using NextGenSoftware.OASIS.API.Providers.ThreeFoldOASIS;
25-
using NextGenSoftware.OASIS.API.Providers.SOLANAOASIS;
2632
using NextGenSoftware.OASIS.API.Providers.LocalFileOASIS;
27-
using NextGenSoftware.OASIS.API.Providers.ArbitrumOASIS;
33+
using NextGenSoftware.OASIS.API.Providers.MongoDBOASIS;
34+
using NextGenSoftware.OASIS.API.Providers.Neo4jOASIS.Aura;
35+
using NextGenSoftware.OASIS.API.Providers.OptimismOASIS;
36+
using NextGenSoftware.OASIS.API.Providers.PinataOASIS;
2837
using NextGenSoftware.OASIS.API.Providers.PolygonOASIS;
2938
using NextGenSoftware.OASIS.API.Providers.RootstockOASIS;
30-
using NextGenSoftware.OASIS.API.Providers.BitcoinOASIS;
31-
using NextGenSoftware.OASIS.API.Providers.AptosOASIS;
32-
using NextGenSoftware.OASIS.API.Providers.TRONOASIS; // TODO: Fix TRONOASIS build errors
33-
using NextGenSoftware.OASIS.API.Providers.HashgraphOASIS;
34-
using NextGenSoftware.OASIS.API.Providers.AvalancheOASIS;
35-
using NextGenSoftware.OASIS.API.Providers.CosmosBlockChainOASIS;
36-
using NextGenSoftware.OASIS.API.Providers.BaseOASIS;
39+
using NextGenSoftware.OASIS.API.Providers.SEEDSOASIS;
40+
using NextGenSoftware.OASIS.API.Providers.SOLANAOASIS;
41+
using NextGenSoftware.OASIS.API.Providers.SQLLiteDBOASIS;
3742
using NextGenSoftware.OASIS.API.Providers.SuiOASIS;
38-
using NextGenSoftware.OASIS.API.Providers.ActivityPubOASIS;
39-
using NextGenSoftware.OASIS.API.Providers.GoogleCloudOASIS;
40-
using NextGenSoftware.OASIS.API.Providers.CardanoOASIS;
41-
using NextGenSoftware.OASIS.API.Providers.BNBChainOASIS;
42-
using NextGenSoftware.OASIS.API.Providers.FantomOASIS;
43-
using NextGenSoftware.OASIS.API.Providers.OptimismOASIS;
44-
using NextGenSoftware.OASIS.API.Providers.ChainLinkOASIS;
45-
//using NextGenSoftware.OASIS.API.Providers.TONOASIS; // Not referenced in Core Only solution
46-
//using NextGenSoftware.OASIS.API.Providers.ZkSyncOASIS;
47-
//using NextGenSoftware.OASIS.API.Providers.LineaOASIS;
48-
//using NextGenSoftware.OASIS.API.Providers.ScrollOASIS;
49-
//using NextGenSoftware.OASIS.API.Providers.XRPLOASIS;
50-
using NextGenSoftware.CLI.Engine;
43+
using NextGenSoftware.OASIS.API.Providers.TelosOASIS;
44+
using NextGenSoftware.OASIS.API.Providers.ThreeFoldOASIS;
45+
using NextGenSoftware.OASIS.API.Providers.TRONOASIS; // TODO: Fix TRONOASIS build errors
46+
using NextGenSoftware.OASIS.Common;
5147
using NextGenSoftware.Utilities;
48+
using System;
49+
using System.Collections.Generic;
50+
using System.IO;
51+
using System.Numerics;
52+
using System.Threading.Tasks;
5253
//using NextGenSoftware.OASIS.API.Providers.ElrondOASIS;
5354
//using NextGenSoftware.OASIS.API.Providers.PolkaDotOASIS;
5455

@@ -1325,7 +1326,24 @@ private static OASISResult<List<ProviderType>> GetProviderTypesFromDNA(string pr
13251326

13261327
private static OASISResult<OASISDNA> LoadOASISDNA(string OASISDNAPath)
13271328
{
1328-
return OASISDNAManager.LoadDNA(OASISDNAPath);
1329+
string dnaPath = Environment.GetEnvironmentVariable("OASIS_DNA_PATH") ?? Path.Combine(AppContext.BaseDirectory, OASISDNAPath);
1330+
1331+
Console.WriteLine($"CurrentDirectory: {Environment.CurrentDirectory}");
1332+
Console.WriteLine($"BaseDirectory: {AppContext.BaseDirectory}");
1333+
Console.WriteLine($"DNA Path being used: {OASISDNAManager.OASISDNAPath}");
1334+
Console.WriteLine($"AppRootDirectory: {AppPathHelper.ResolveAppRootDirectory()}");
1335+
Console.WriteLine($"AppRootDirectory: {AppPathHelper.ResolveAppRootDirectory()}");
1336+
Console.WriteLine($"OASISDNAPath: {OASISDNAPath}");
1337+
Console.WriteLine($"dnaPath: {dnaPath}");
1338+
1339+
var dnaResult = OASISDNAManager.LoadDNA(dnaPath);
1340+
1341+
Console.WriteLine($"DNA Load Success: {!dnaResult.IsError}");
1342+
Console.WriteLine($"DNA Load Message: {dnaResult.Message}");
1343+
Console.WriteLine($"OASISDNA null: {OASISDNAManager.OASISDNA == null}");
1344+
1345+
return dnaResult;
1346+
//return OASISDNAManager.LoadDNA(OASISDNAPath);
13291347
}
13301348

13311349
private static async Task<OASISResult<OASISDNA>> LoadOASISDNAAsync(string OASISDNAPath)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
4+
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
5+
-->
6+
<Project>
7+
<PropertyGroup>
8+
<WebPublishMethod>FTP</WebPublishMethod>
9+
<PublishProvider>AzureWebSite</PublishProvider>
10+
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
11+
<LastUsedPlatform>Any CPU</LastUsedPlatform>
12+
<SiteUrlToLaunchAfterPublish>https://oasisapionode-hseudrexdvbhenhv.canadacentral-01.azurewebsites.net</SiteUrlToLaunchAfterPublish>
13+
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
14+
<ExcludeApp_Data>false</ExcludeApp_Data>
15+
<ProjectGuid>a8131b22-06ec-424a-b689-9411c8176be8</ProjectGuid>
16+
<publishUrl>ftps://waws-prod-yt1-101.ftp.azurewebsites.windows.net</publishUrl>
17+
<DeleteExistingFiles>false</DeleteExistingFiles>
18+
<FtpPassiveMode>true</FtpPassiveMode>
19+
<FtpSitePath>site/wwwroot</FtpSitePath>
20+
<UserName>OASISAPIONODE\$OASISAPIONODE</UserName>
21+
<_SavePWD>true</_SavePWD>
22+
</PropertyGroup>
23+
</Project>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
4+
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
5+
-->
6+
<Project>
7+
<PropertyGroup>
8+
<WebPublishMethod>MSDeploy</WebPublishMethod>
9+
<PublishProvider>AzureWebSite</PublishProvider>
10+
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
11+
<LastUsedPlatform>Any CPU</LastUsedPlatform>
12+
<SiteUrlToLaunchAfterPublish>https://oasisapionode-hseudrexdvbhenhv.canadacentral-01.azurewebsites.net</SiteUrlToLaunchAfterPublish>
13+
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
14+
<ExcludeApp_Data>false</ExcludeApp_Data>
15+
<ProjectGuid>a8131b22-06ec-424a-b689-9411c8176be8</ProjectGuid>
16+
<MSDeployServiceURL>oasisapionode-hseudrexdvbhenhv.scm.canadacentral-01.azurewebsites.net:443</MSDeployServiceURL>
17+
<DeployIisAppPath>OASISAPIONODE</DeployIisAppPath>
18+
<RemoteSitePhysicalPath />
19+
<SkipExtraFilesOnServer>true</SkipExtraFilesOnServer>
20+
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
21+
<EnableMSDeployBackup>true</EnableMSDeployBackup>
22+
<EnableMsDeployAppOffline>true</EnableMsDeployAppOffline>
23+
<UserName>$OASISAPIONODE</UserName>
24+
<_SavePWD>true</_SavePWD>
25+
<_DestinationType>AzureWebSite</_DestinationType>
26+
<InstallAspNetCoreSiteExtension>false</InstallAspNetCoreSiteExtension>
27+
</PropertyGroup>
28+
</Project>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
4+
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
5+
-->
6+
<Project>
7+
<PropertyGroup>
8+
<WebPublishMethod>ZipDeploy</WebPublishMethod>
9+
<PublishProvider>AzureWebSite</PublishProvider>
10+
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
11+
<LastUsedPlatform>Any CPU</LastUsedPlatform>
12+
<SiteUrlToLaunchAfterPublish>https://oasisapionode-hseudrexdvbhenhv.canadacentral-01.azurewebsites.net</SiteUrlToLaunchAfterPublish>
13+
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
14+
<ProjectGuid>a8131b22-06ec-424a-b689-9411c8176be8</ProjectGuid>
15+
<PublishUrl>https://oasisapionode-hseudrexdvbhenhv.scm.canadacentral-01.azurewebsites.net/</PublishUrl>
16+
<UserName>$OASISAPIONODE</UserName>
17+
<_SavePWD>true</_SavePWD>
18+
</PropertyGroup>
19+
</Project>

0 commit comments

Comments
 (0)