mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-23 17:26:35 +00:00
feat(initializing): Implement additional server type field for server installation
This commit is contained in:
parent
8a93af2b06
commit
f5a75e6eb5
|
@ -294,6 +294,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi {
|
||||||
required final String dnsApiToken,
|
required final String dnsApiToken,
|
||||||
required final User rootUser,
|
required final User rootUser,
|
||||||
required final String domainName,
|
required final String domainName,
|
||||||
|
required final String serverType,
|
||||||
}) async {
|
}) async {
|
||||||
ServerHostingDetails? details;
|
ServerHostingDetails? details;
|
||||||
|
|
||||||
|
@ -307,6 +308,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi {
|
||||||
rootUser: rootUser,
|
rootUser: rootUser,
|
||||||
domainName: domainName,
|
domainName: domainName,
|
||||||
dataBase: newVolume,
|
dataBase: newVolume,
|
||||||
|
serverType: serverType,
|
||||||
);
|
);
|
||||||
|
|
||||||
return details;
|
return details;
|
||||||
|
@ -317,6 +319,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi {
|
||||||
required final User rootUser,
|
required final User rootUser,
|
||||||
required final String domainName,
|
required final String domainName,
|
||||||
required final ServerVolume dataBase,
|
required final ServerVolume dataBase,
|
||||||
|
required final String serverType,
|
||||||
}) async {
|
}) async {
|
||||||
final Dio client = await getClient();
|
final Dio client = await getClient();
|
||||||
|
|
||||||
|
@ -336,7 +339,7 @@ class DigitalOceanApi extends ServerProviderApi with VolumeProviderApi {
|
||||||
|
|
||||||
final Map<String, Object> data = {
|
final Map<String, Object> data = {
|
||||||
'name': hostname,
|
'name': hostname,
|
||||||
'server_type': 'cx11',
|
'server_type': serverType,
|
||||||
'start_after_create': false,
|
'start_after_create': false,
|
||||||
'image': 'ubuntu-20.04',
|
'image': 'ubuntu-20.04',
|
||||||
'volumes': dbUuid == null ? [dbId] : [dbUuid],
|
'volumes': dbUuid == null ? [dbId] : [dbUuid],
|
||||||
|
|
|
@ -298,6 +298,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi {
|
||||||
required final String dnsApiToken,
|
required final String dnsApiToken,
|
||||||
required final User rootUser,
|
required final User rootUser,
|
||||||
required final String domainName,
|
required final String domainName,
|
||||||
|
required final String serverType,
|
||||||
}) async {
|
}) async {
|
||||||
ServerHostingDetails? details;
|
ServerHostingDetails? details;
|
||||||
|
|
||||||
|
@ -311,6 +312,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi {
|
||||||
rootUser: rootUser,
|
rootUser: rootUser,
|
||||||
domainName: domainName,
|
domainName: domainName,
|
||||||
dataBase: newVolume,
|
dataBase: newVolume,
|
||||||
|
serverType: serverType,
|
||||||
);
|
);
|
||||||
|
|
||||||
return details;
|
return details;
|
||||||
|
@ -321,6 +323,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi {
|
||||||
required final User rootUser,
|
required final User rootUser,
|
||||||
required final String domainName,
|
required final String domainName,
|
||||||
required final ServerVolume dataBase,
|
required final ServerVolume dataBase,
|
||||||
|
required final String serverType,
|
||||||
}) async {
|
}) async {
|
||||||
final Dio client = await getClient();
|
final Dio client = await getClient();
|
||||||
|
|
||||||
|
@ -343,7 +346,7 @@ class HetznerApi extends ServerProviderApi with VolumeProviderApi {
|
||||||
try {
|
try {
|
||||||
final Map<String, Object> data = {
|
final Map<String, Object> data = {
|
||||||
'name': hostname,
|
'name': hostname,
|
||||||
'server_type': 'cx11',
|
'server_type': serverType,
|
||||||
'start_after_create': false,
|
'start_after_create': false,
|
||||||
'image': 'ubuntu-20.04',
|
'image': 'ubuntu-20.04',
|
||||||
'volumes': [dbId],
|
'volumes': [dbId],
|
||||||
|
|
|
@ -21,6 +21,7 @@ abstract class ServerProviderApi extends ApiMap {
|
||||||
required final String dnsApiToken,
|
required final String dnsApiToken,
|
||||||
required final User rootUser,
|
required final User rootUser,
|
||||||
required final String domainName,
|
required final String domainName,
|
||||||
|
required final String serverType,
|
||||||
});
|
});
|
||||||
Future<void> createReverseDns({
|
Future<void> createReverseDns({
|
||||||
required final ServerHostingDetails serverDetails,
|
required final ServerHostingDetails serverDetails,
|
||||||
|
|
|
@ -16,7 +16,6 @@ import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_
|
||||||
import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart';
|
import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart';
|
||||||
import 'package:selfprivacy/logic/api_maps/rest_maps/server.dart';
|
import 'package:selfprivacy/logic/api_maps/rest_maps/server.dart';
|
||||||
import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider.dart';
|
import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider.dart';
|
||||||
import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_api_settings.dart';
|
|
||||||
import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_factory.dart';
|
import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_factory.dart';
|
||||||
import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart';
|
import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart';
|
||||||
import 'package:selfprivacy/logic/models/hive/backblaze_credential.dart';
|
import 'package:selfprivacy/logic/models/hive/backblaze_credential.dart';
|
||||||
|
@ -247,6 +246,7 @@ class ServerInstallationRepository {
|
||||||
dnsApiToken: cloudFlareKey,
|
dnsApiToken: cloudFlareKey,
|
||||||
rootUser: rootUser,
|
rootUser: rootUser,
|
||||||
domainName: domainName,
|
domainName: domainName,
|
||||||
|
serverType: getIt<ApiConfigModel>().serverType!,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (serverDetails == null) {
|
if (serverDetails == null) {
|
||||||
|
@ -277,6 +277,7 @@ class ServerInstallationRepository {
|
||||||
dnsApiToken: cloudFlareKey,
|
dnsApiToken: cloudFlareKey,
|
||||||
rootUser: rootUser,
|
rootUser: rootUser,
|
||||||
domainName: domainName,
|
domainName: domainName,
|
||||||
|
serverType: getIt<ApiConfigModel>().serverType!,
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print(e);
|
print(e);
|
||||||
|
@ -314,6 +315,7 @@ class ServerInstallationRepository {
|
||||||
dnsApiToken: cloudFlareKey,
|
dnsApiToken: cloudFlareKey,
|
||||||
rootUser: rootUser,
|
rootUser: rootUser,
|
||||||
domainName: domainName,
|
domainName: domainName,
|
||||||
|
serverType: getIt<ApiConfigModel>().serverType!,
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print(e);
|
print(e);
|
||||||
|
|
|
@ -154,7 +154,8 @@ class SelectTypePage extends StatelessWidget {
|
||||||
Text('disk: $type.disk.gibibyte'),
|
Text('disk: $type.disk.gibibyte'),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Text(
|
Text(
|
||||||
'price: $type.price.value $type.price.currency'),
|
'price: $type.price.value $type.price.currency',
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue