需要帮助找到一种方法来部署我的应用程序的自定义应用程序设置 - 1.使用我的.funproj创建的appsettings.json(vs 2015的工具) 2. appveyor的环境变量 3.任何其他技巧
我想要的是避免在门户中手动设置这些东西并让它们受源控制(更好 - 使用部署,例如 - appveyor的安全环境变量)
提前致谢! 下面是我要定位的门户网站设置示例 -
appveyor的环境变量设置示例 -
environment:
SolutionDir: $(APPVEYOR_BUILD_FOLDER)\
my_var1: value1
my_var2: value2
功能app(run.csx)中的示例用法 -
using System;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Messaging;
public static void Run(string input, TraceWriter log)
{
log.Info($"C# manually triggered function called with input: {input}");
log.Info($"This is a custom setting: {GetEnvironmentVariable("my_var1")}");
}
public static string GetEnvironmentVariable(string name)
{
return name + ": " +
System.Environment.GetEnvironmentVariable(name, EnvironmentVariableTarget.Process);
}
答案 0 :(得分:3)
您可以通过手臂模板执行此操作。要执行此操作的示例手臂模板:
server
{
listen 80;
root /var/www/demoApp;
index index.php index.html index.htm;
server_name localhost;
error_page 500 404 /404.php;
location /
{
try_files $uri $uri/ /index.php?$query_string;
}
location /wordpress
{
try_files $uri $uri/ /index.php?$query_string;
rewrite ^(.*)$ /wordpress/index.php?$1 last;
location ~ \.php
{
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
location ~ \.php$
{
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
您可以阅读如何从VSTS自动部署:use-vsts-to-deploy-functions-as-infrastructure-as-code