@@ -51,20 +51,40 @@ [this document](https://bitwarden.com/help/vault-management-api/).
5151
5252config . SwaggerDoc ( "internal" , new OpenApiInfo { Title = "Bitwarden Internal API" , Version = "latest" } ) ;
5353
54- // Configure Bitwarden cloud US and EU servers. These will appear in the swagger.json build artifact
55- // used for our help center. These are overwritten with the local server when running in self-hosted
56- // or dev mode (see Api Startup.cs).
57- config . AddSwaggerServerWithSecurity (
58- serverId : "US_server" ,
59- serverUrl : "https://api.bitwarden.com" ,
60- identityTokenUrl : "https://identity.bitwarden.com/connect/token" ,
61- serverDescription : "US server" ) ;
62-
63- config . AddSwaggerServerWithSecurity (
64- serverId : "EU_server" ,
65- serverUrl : "https://api.bitwarden.eu" ,
66- identityTokenUrl : "https://identity.bitwarden.eu/connect/token" ,
67- serverDescription : "EU server" ) ;
54+ if ( environment . IsDevelopment ( ) )
55+ {
56+ // Generate swagger for development servers
57+ config . AddSwaggerServerWithSecurity (
58+ serverId : "Development_server" ,
59+ serverUrl : globalSettings . BaseServiceUri . Api ,
60+ identityTokenUrl : $ "{ globalSettings . BaseServiceUri . Identity } /connect/token",
61+ serverDescription : "Development server" ) ;
62+ }
63+ else if ( globalSettings . SelfHosted )
64+ {
65+ // Generate swagger for self-hosted servers
66+ config . AddSwaggerServerWithSecurity (
67+ serverId : "Self_hosted_server" ,
68+ serverUrl : globalSettings . BaseServiceUri . Api ,
69+ identityTokenUrl : $ "{ globalSettings . BaseServiceUri . Identity } /connect/token",
70+ serverDescription : "Self-hosted server" ) ;
71+ }
72+ else
73+ {
74+ // Configure swagger for Bitwarden cloud servers. These will appear in the swagger.json build artifact
75+ // used for our help center.
76+ config . AddSwaggerServerWithSecurity (
77+ serverId : "US_server" ,
78+ serverUrl : "https://api.bitwarden.com" ,
79+ identityTokenUrl : "https://identity.bitwarden.com/connect/token" ,
80+ serverDescription : "US server" ) ;
81+
82+ config . AddSwaggerServerWithSecurity (
83+ serverId : "EU_server" ,
84+ serverUrl : "https://api.bitwarden.eu" ,
85+ identityTokenUrl : "https://identity.bitwarden.eu/connect/token" ,
86+ serverDescription : "EU server" ) ;
87+ }
6888
6989config . DescribeAllParametersInCamelCase ( ) ;
7090// config.UseReferencedDefinitionsForEnums();