blob: b9437e49e4d48aea4aa2c70d0376b86e33dd30bb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
using Microsoft.Azure.Management.AppService.Fluent;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.AzureUtils.Deployment;
using Tango.Core;
public static class ExtensionMethods
{
public static async Task<MachineServiceSettings> GetMachineServiceSettingsAsync(this IWebAppBase app)
{
MachineServiceSettings settings = new MachineServiceSettings();
var s = await app.GetAppSettingsAsync();
settings.DB_ADDRESS = s[nameof(MachineServiceSettings.DB_ADDRESS)].Value;
settings.DB_CATALOG = s[nameof(MachineServiceSettings.DB_CATALOG)].Value;
settings.DB_USER_NAME = s[nameof(MachineServiceSettings.DB_USER_NAME)].Value;
settings.DB_PASSWORD = s[nameof(MachineServiceSettings.DB_PASSWORD)].Value;
settings.STORAGE_ACCOUNT = s[nameof(MachineServiceSettings.STORAGE_ACCOUNT)].Value;
settings.MACHINE_STUDIO_VERSIONS_CONTAINER = s[nameof(MachineServiceSettings.MACHINE_STUDIO_VERSIONS_CONTAINER)].Value;
settings.TANGO_VERSIONS_CONTAINER = s[nameof(MachineServiceSettings.TANGO_VERSIONS_CONTAINER)].Value;
return settings;
}
public static DataSource ToDataSource(this MachineServiceSettings settings)
{
DataSource dataSource = new DataSource();
dataSource.Type = DataSourceType.SQLServer;
dataSource.Address = settings.DB_ADDRESS;
dataSource.Catalog = settings.DB_CATALOG;
dataSource.UserName = settings.DB_USER_NAME;
dataSource.Password = settings.DB_PASSWORD;
dataSource.IntegratedSecurity = false;
return dataSource;
}
}
|