Skip to content

Add Swagger UI Integration for Config Server #60

Description

@TimHess

The config server image has no default page and shows a white-label error when you request anything other than a valid actuator or config path. Consider adding SwaggerUI to provide documentation and demonstration of the available REST endpoints. This is an untested suggestion of how to implement:

  1. Use the springdoc-openapi-starter-webmvc-ui library
  2. Configure properties
    springdoc:
        swagger-ui:
          # Custom path to access the UI (default is /swagger-ui.html)
          path: /swagger-ui.html
          # Disables the default "Swagger Petstore" sample if it appears
          disable-swagger-default-url: true
  3. When Spring Security is active, permit access to swagger resources
    @Bean
    public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
        http.authorizeHttpRequests(auth -> auth
            .requestMatchers("/swagger-ui/**", "/v3/api-docs/**", "/swagger-ui.html").permitAll()
            .anyRequest().authenticated()
        );
        return http.build();
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions