小编Gan*_*der的帖子

如何在启用 TLS 配置的情况下连接到 Traefik TCP 服务?

我正在尝试配置Traefik,以便我可以通过域名访问服务,并且不必设置不同的端口。例如,两个 MongoDB 服务,都在默认端口上,但在不同的域中,example.localhost并且example2.localhost. 只有这个例子有效。我的意思是,其他情况可能有效,但我无法连接到它们,我不明白问题是什么。这可能甚至不是 Traefik 的问题。

我准备了一个包含一个有效示例的存储库。您只需要使用mkcert生成您自己的证书。页面example.localhost返回403 Forbidden错误,但您不必担心,因为此配置的目的是显示 SSL 正在工作(挂锁,绿色状态)。所以不要专注于403.

只有到mongo服务的 SSL 连接有效。我用Robo 3T程序对其进行了测试。选择 SSL 连接后,提供主机example.localhost并为自签名(或自己的)连接选择证书即可。这是唯一有效的方法。无论我是否提供证书,与redisRedis 桌面管理器)和pgsqlPhpStormDBeaverDbVisualizer)的连接都不起作用。我不将 SSL 转发到服务,我只连接到 Traefik。我花了很长时间在上面。我在互联网上搜索。我还没有找到答案。有没有人解决过这个问题?

附注。我在 Linux Mint 上工作,所以我的配置应该可以在这个环境中正常工作,没有任何问题。我会要求 Linux 的解决方案。


如果您不想浏览存储库,我附上最重要的文件:

docker-compose.yml

version: "3.7"

services:
    traefik:
        image: traefik:v2.0
        ports:
            - 80:80
            - 443:443
            - 8080:8080
            - 6379:6379
            - …
Run Code Online (Sandbox Code Playgroud)

postgresql ssl tcp docker traefik

14
推荐指数
1
解决办法
5104
查看次数

create() 生命周期钩子中的 vue 异步调用

我需要在created(). 为此,我需要制作created()as async。根据 Vue 文档,created()称为synchronously。Vue 框架会await避免created()任何竞争条件吗?

this.isAuthenticated = await authService.isAuthenticated();
Run Code Online (Sandbox Code Playgroud)

vue.js vuejs2

9
推荐指数
1
解决办法
2万
查看次数

字体系列“Poppins”在加载时无法在我的网站上正常工作

首先我要感谢这个网站上所有伟大的人。如果没有 SO 的帮助,我会很迷失。

我正在尝试引用谷歌字体的排版。问题是,当我推送更改时,字体将显示在控制台上,但不会在实际网站上呈现。

这是我导入代码的方式

<style>
@import url('https://fonts.googleapis.com/css?family=Poppins:400,700,900');
</style>
Run Code Online (Sandbox Code Playgroud)
.text{ 
    font-family: 'poppins-bold', sans-serif !important;
    font-size: 6.3rem;
    line-height: 1.333;
    margin-top: 0;
    color: #FFFFFF;
    text-align: center;
}
Run Code Online (Sandbox Code Playgroud)

请查看此处的网站并亲自查看。

有什么方法可以解决这个问题吗?

fonts google-font-api

7
推荐指数
2
解决办法
6万
查看次数

如何在 Vue/Webpack 中配置热重载以在任何测试域上工作

我使用脚本语言创建了一个后端项目,并使用 Vue-CLI 创建了一个前端项目。该项目已在域中进行测试example.localhost。在测试环境中我运行Vue-CLI开发版本(localhost:8080)并在项目页面上使用它example.localhost:80。这部分有效。“热重载”不起作用。

在 Vue-CLI、Webpack 和 SockJS 项目存储库上,我看到了有关由于 SockJS 的更改而导致此模块失败的问题线程,但添加了一个解决方法,直到 SockJS 案例得到解决。

我在我的案例中找到了一个有效的配置,但是这个配置非常依赖于测试域名,这是我想避免的。我希望它能够在其他测试域上工作,但它无法以当前的形式工作。

在之前的尝试中,我什至遇到了 CORS 的情况,但在准备这个示例时,我无法再次获得这种状态。我不接受 的解决方案disableHostCheck: true。问题是,它必须在不影响安全性的情况下工作。


./ docker-compose.yml

version: '3'

services:
  dev:
    image: gander/dev:7.3
    volumes:
      - ./public/index.html:/www/example.localhost/public/index.html
    ports:
      - 80:80
Run Code Online (Sandbox Code Playgroud)

./public/index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Example</title>
</head>
<body>
<div id="app">Vue App</div>
<script src="http://localhost:8080/js/app.js"></script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

./包.json

{
  "name": "sandbox-vue-dev",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build"
  },
  "dependencies": {
    "core-js": …
Run Code Online (Sandbox Code Playgroud)

javascript webpack-dev-server vuejs2 hot-reload vue-cli-3

6
推荐指数
1
解决办法
1218
查看次数

Vue ApexCharts 动态更新数据系列

如何更新ApexCharts系列中的数据 我使用ApexCharts创建了以下Vue 组件。该组件从一堆这些组件所在的父级获取更新。更新后的值是通过 props 传入的。

<template>
  <div>
    <apexchart type="line" width="1000px" :options="options" :series="series"></apexchart>
  </div>
</template>

<script>
import Vue from 'vue';
import VueApexCharts from 'vue-apexcharts';

Vue.use(VueApexCharts);
Vue.component('apexchart', VueApexCharts);

export default {
  name: 'EnergyConsumption',
  props: {
    channel1: Number,
    channel2: Number,
  },
  data() {
    return {
      options: {
        chart: {
          id: 'vuechart-example',
        },
        xaxis: {
          categories: ['Channel 1', 'Channel 2'],
        },
      },
      series: [
        {
          name: 'series-1',
          data: [this.channel1, this.channel2],
        },
      ],
    };
  },
  methods: {
    updateSeries() …
Run Code Online (Sandbox Code Playgroud)

vue.js apexcharts

5
推荐指数
3
解决办法
1万
查看次数

安装 protoc-gen-grpc-web

我目前正在使用 grpc-web 为我的服务编写一个简单的客户端。我创建了一个 service.proto 文件,该文件已使用 protoc 成功编译。当我尝试使用插件 protoc-gen-grpc-web 生成 gRPC-Web 服务客户端存根时,问题出现了,尽管安装了后者,但该插件仍无法工作。

出现以下错误:

protoc -I=./ service.proto --grpc-web_out=import_style=commonjs,mode=grpcwebtext:./
protoc-gen-grpc-web: program not found or is not executable
--grpc-web_out: protoc-gen-grpc-web: Plugin failed with status code 1.
Run Code Online (Sandbox Code Playgroud)

关于如何解决这个问题有什么建议吗?谢谢你!

grpc-web

5
推荐指数
1
解决办法
1万
查看次数

ESLint 期望在方法结束时返回一个值

我有这个代码

computed: {
   termOptions() {
      if (this.newSchedule.originCharges.serviceType !== 'If Any') {
        return this.serviceOptions.filter((val) => val.name !== 'If Any');
      }
    },
    isMoreThanToday() {
      if (this.newSchedule.validFrom) {
        const date = new Date();
        const isMore = this.newSchedule.validFrom < date.getDate();
        return isMore;
      }
    },
}
Run Code Online (Sandbox Code Playgroud)

我收到一个错误,指出 of 方法的预期返回值。有没有什么办法解决这一问题?谢谢。

eslint vue.js

3
推荐指数
1
解决办法
4667
查看次数

Vue Vuetify:无效的道具:道具“值”的自定义验证器检查失败。在 ---&gt; &lt;VFileInput&gt; 中找到

我有几个文本字段的表单,这没有给我带来任何问题。但是我有这个文件字段我无法绑定到我的模型。任何猜测。

<template>
    <v-form ref="form" @submit.prevent="submit" lazy-validation v-model="valid">
        <v-card outlined>
            <v-card-text>
                <v-file-input
                    type="file"
                    :label="labels.user_header_photo"
                    v-model="form.user_header_photo"
                    :error-messages="errors.user_header_photo"
                    :rules="[rules.required('user_header_photo')]"
                    :disabled="loading"
                    @input="clearErrors('user_header_photo')"
                >
                </v-file-input>

                <v-file-input
                    type="file"
                    :label="labels.user_profile_photo"
                    v-model="form.user_profile_photo"
                    :error-messages="errors.user_profile_photo"
                    :rules="[rules.required('user_profile_photo')]"
                    :disabled="loading"
                    @input="clearErrors('user_profile_photo')"
                >
                </v-file-input>

            </v-card-text>
        </v-card>

        <v-divider class="mb-4 mt-4"></v-divider>

        <v-card>
            <v-card-text>
                <v-text-field
                    :label="labels.user_name"
                    v-model="form.user_name"
                    :error-messages="errors.user_name"
                    :disabled="loading"
                    hint="At least 6 characters"
                    autocomplete="user_name"
                    @input="clearErrors('user_name')"
                ></v-text-field>

                <v-text-field
                    :label="labels.user_subscription_fee"
                    v-model="form.user_subscription_fee"
                    :error-messages="errors.user_subscription_fee"
                    :disabled="loading"
                    autocomplete="user_subscription_fee"
                    @input="clearErrors('user_subscription_fee')"
                ></v-text-field>
            </v-card-text>
        </v-card>

        <v-layout mt-12 mx-0>
            <v-spacer></v-spacer>

            <v-btn
                text
                :disabled="loading"
                :to="{ name: 'profile' }"
                color="grey darken-2"
                exact
            >
                Cancel
            </v-btn>

            <v-btn
                type="submit"
                :loading="loading"
                :disabled="loading" …
Run Code Online (Sandbox Code Playgroud)

vue.js vueify

3
推荐指数
2
解决办法
5059
查看次数