登录
首页 >  Golang >  Go问答

如何从 Azure 应用程序配置读取值

来源:stackoverflow

时间:2024-04-18 21:42:35 205浏览 收藏

偷偷努力,悄无声息地变强,然后惊艳所有人!哈哈,小伙伴们又来学习啦~今天我将给大家介绍《如何从 Azure 应用程序配置读取值》,这篇文章主要会讲到等等知识点,不知道大家对其都有多少了解,下面我们就一起来看一吧!当然,非常希望大家能多多评论,给出合理的建议,我们一起学习,一起进步!

问题内容

我希望我的 go 应用从 azure 应用程序配置读取值。

对于我使用的 spring boot 应用程序

<groupId>com.microsoft.azure</groupId>
<artifactId>spring-cloud-starter-azure-appconfiguration-config</artifactId>

我想知道是否有一些类似的、易于使用的 go 库?


解决方案


据我所知,有一种方法可以获取应用程序 configuration

func getappconfiguration(ctx context.context, name string) (createdconfig web.siteconfigresource, err error) {
    client, err := getwebappsclient()
    if err != nil {
        return
    }
    createdconfig, err = client.getconfiguration(ctx, config.groupname(), name)
    return
}

否则,您需要将其定义为环境变量,即在 webconfig 中定义为

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <handlers>
            <add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
        </handlers>
        <!-- For Go webapp, we always generate azureapp.exe in wwwroot -->
        <httpPlatform processPath="D:\home\site\wwwroot\azureapp.exe" startupTimeLimit="60">
        </httpPlatform>
    </system.webServer>
</configuration>

理论要掌握,实操不能落!以上关于《如何从 Azure 应用程序配置读取值》的详细介绍,大家都掌握了吧!如果想要继续提升自己的能力,那么就来关注golang学习网公众号吧!

声明:本文转载于:stackoverflow 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
最新阅读
更多>
课程推荐
更多>