blogspot.com-GA4

星期日, 7月 06, 2025

Springboot Jasypt 設定application yaml 無法解密問題處理

使用版本 Springboot3.5.0

引用版本
  <dependency>
    <groupid>com.github.ulisesbocchio</groupid>
    <artifactid>jasypt-spring-boot-starter</artifactid>
    <version>3.0.5</version>
  </dependency>


啟用加密功能application run

import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@EnableEncryptableProperties // 啟用 Jasypt 加密功能
public class YourApplication {

  public static void main(String[] args) {
    SpringApplication.run(YourApplication.class, args);
  }
}


在application.properties 中設定
jasypt.encryptor.password=your_secret_password
spring.datasource.password=pwd

在YAML中設定
jasypt:
   encryptor:
     password: your_secret_password
spring:
  datasource:
    password: ENC(C/q1R8y***************aWFEnVZ0rg==)

注意在此如果用env 設定

name: spring.datasource.password
value: ENC(C/q1R8y***************aWFEnVZ0rg==)


用以上的方式設定時,在啟動時發現密碼並無法生效,可能是因替換參數時無法啟動解密,改用以下 YAML設定環境變數替代

application.properties值
jasypt.encryptor.password=${DB_PASS}

在YAML中設定
name: DB_PASS
value: ENC(C/q1R8y***************aWFEnVZ0rg==)

星期四, 1月 16, 2025

重設 Kubernetes

重設Kubernetes kubeadm reset -f

然後移除 $HOME/.kube/config 檔案
rm $HOME/.kube/config

停止 kubelet 跟 docker 的服務 systemctl stop kubelet systemctl stop docker

刪除有關連到的資料夾 rm -rf /var/lib/cni/ rm -rf /var/lib/kubelet/* rm -rf /etc/cni/

關閉相關的網路介面卡 ifconfig cni0 down ifconfig flannel.1 down ifconfig docker0 down

刪除對應的虛擬裝置 ip link delete cni0 ip link delete flannel.1

最後,重新啟動 kubelet 跟 docker 的服務 systemctl restart kubelet systemctl restart docker

參考來源:https://ithelp.ithome.com.tw/m/articles/10262330

星期三, 1月 15, 2025

nano 快捷鍵

Ctrl+K 剪下整列或選取範圍
Alt+6 複製整列或選取範圍
Ctrl+6 開始選取
Ctrl+U 貼上剪貼簿內容
Alt+U Undo
Alt+E Redo
Alt+Del 刪除整行
Alt+3 Comment/Uncomment
Alt+/ || Alt+G 跳到指定行數
Ctrl+G Help
Alt+W || F6 尋找
Alt+Q 尋找下一個
Alt+W 尋找上一個
Alt+R 尋找並置換
Alt+X 關閉下方 Help 提示
Ctrl+S 存檔
Ctrl+O 另存新檔
Ctrl+X 退出

參考來源:https://www.nano-editor.org/dist/latest/cheatsheet.html #UNIX #NANO