0%
خادم الإعدادات Configuration Server باستخدام Spring Cloud Config

خادم الإعدادات

الإعدادات المركزية

10-15 دقيقة

خادم الإعدادات Configuration Server باستخدام Spring Cloud Config

في هذا الدرس سنستكشف كيفية إعداد خادم إعدادات مركزي باستخدام Spring Cloud Config. وسنرى كيف ندير الإعدادات بصورة مركزية وآمنة.

إعداد الخادم

الاعتماديات

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-config-server</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>

الإعداد الأساسي

server:
  port: 8888

spring:
  application:
    name: config-server
  cloud:
    config:
      server:
        git:
          uri: https://github.com/your-org/config-repo
          default-label: main
          search-paths: 
            - config/*/default
            - config/*/prod
          clone-on-start: true

الفئة الرئيسية

@SpringBootApplication
@EnableConfigServer
@EnableDiscoveryClient
public class ConfigServerApplication {
    public static void main(String[] args) {
        SpringApplication.run(ConfigServerApplication.class, args);
    }
}

التعليقات

التعليقات مدعومة عبر GitHub Discussions

سجّل الدخول باستخدام GitHub للمشاركة في النقاش

تم نسخ الرابط!