解决Gitlab的Gravatar头像无法显示的问题

背景:Gravatar 的服务最近一直都无法访问,很多服务都遭了殃,虽然不影响使用但是非常碍眼。

最近我在尝试 Omnibus 的 gitlab,顺手打算看看能不能解决一下,发现结合网上常见的 duoshuo CDN的方式还是比较容易的,记录如下:

普通版Gitlab:

编辑 gitlab.yml , 找到如下部分:

## Gravatar
gravatar:
    enabled: true                 # Use user avatar image from Gravatar.com (default: true)
    # gravatar urls: possible placeholders: %{hash} %{size} %{email}
    # plain_url: "http://..."     # default: http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon
    # ssl_url:   "https://..."    # default: https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon

plain_url 的注释去掉,写成如下内容:

plain_url: "http://gravatar.duoshuo.com/avatar/%{hash}?s=%{size}&d=identicon"

重启服务

如果gitlab不是新搭建的,依然会有一些头像地址会指向原先的地址,需要执行下面的命令修正缓存数据(感谢的objdump补充):

rake cache:clear RAILS_ENV=production

Omnibus 版 Gitlab

编辑 /etc/gitlab/gitlab.rb,增加下面这一行:

gitlab_rails['gravatar_plain_url'] = 'http://gravatar.duoshuo.com/avatar/%{hash}?s=%{size}&d=identicon'

在命令行执行

sudo gitlab-ctl reconfigure 
sudo gitlab-rake cache:clear RAILS_ENV=production

转载于:https://my.oschina.net/anylain/blog/355797

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值