当前位置: 首页 > article >正文

gitlab配置调试minio

官方文档

rails console 调试

  • 查看配置
    Settings.uploads.object_store
    
  • 加载minio client
    require 'fog/aws'
    
    fog_connection = Fog::Storage.new(
      provider: 'AWS',
      aws_access_key_id: '你的MINIO_ACCESS_KEY',
      aws_secret_access_key: '你的MINIO_SECRET_KEY',
      region: '<S3 region>',
      endpoint: 'http://127.0.0.2:7480',
      path_style: true # 需要开启 path_style
    )
    
    bucket = fog_connection.directories.get('你的BUCKET_NAME')
    
  • 创建测试文件
    require 'tempfile'
    
    temp_file = Tempfile.new(['test_upload', '.txt'])
    temp_file.write('这是一个测试文件内容')
    temp_file.rewind # 将文件指针移到开头
    
  • 模拟上传到minio
    bucket.files.create(
      key: file_path,
      body: temp_file.read,
      public: false
    )
    
  • 获取文件
    uploaded_file = bucket.files.get(file_path)
    uploaded_file.key
    uploaded_file.body
    
  • 删除文件
    uploaded_file.destroy
    
  • Giltab上传
    uploader = FileUploader.new
    uploader.store!(temp_file)
    
    puts "上传路径: #{uploader.url}"
    

注意事项

  • path_style: true # Use ‘host/bucket_name/object’ instead of ‘bucket_name.host/object’
  • proxy_download: false # Passthrough all downloads via GitLab instead of using Redirects to Object Storage

http://www.kler.cn/a/429825.html

相关文章:

  • Java将数组转换成字符串
  • 构建万能 MOCK-API
  • 如何在拉丁美洲推广游戏
  • docker逃逸总结
  • vue+elementUI+transition实现鼠标滑过div展开内容,鼠标划出收起内容,加防抖功能
  • docker搭建elasticsearch服务
  • python爬虫--小白篇【爬虫实践】
  • R 语言科研绘图第 4 期 --- 折线图-置信区间
  • 一种基于通义千问prompt辅助+Qwen2.5-coder-32b+Bolt.new+v0+Cursor的无代码对话网站构建方法
  • 使用 RabbitMQ 创建简单消费者的完整指南
  • 什么是Layer Normalization?
  • SpringBoot下类加入容器的几种方式
  • K8S命令部署后端(流水线全自动化部署)
  • P2249 【深基13.例1】查找
  • 2.linux中调度kettle
  • React - useActionState、useFormStatus与表单处理
  • 小迪笔记 第四十五天 sql 注入进阶 :二次注入,堆叠注入,数据读取(load_file)加外带
  • 适配器模式——设计模式
  • 数据分析:学习指南
  • DDR的跨4K问题