ã©ããã§è¦ãããæ°ãããã®ã§ãããå¿ããã®ã§èªåã§è¨å®ãã¦ã¿ã¦ãã®çµæãæ®ãã¦ããã¾ãã
çµç·¯
ãã¡ãã£ã¨é¢ç½ãããä½ã£ããï¼ã¿ããªè¦ã¦ã¿ã¦ã¼ãã¨GitHubãBitbucketã«ã½ã¼ã¹ãã¢ãããããã®ã®ãWebãµã¼ãã¹ã®ã¢ã¯ã»ã¹ãã¼ã¯ã³çãã¹ãæ¸ãããã¦ã¦éãæå³ã§ã¢ãã¼ã«ãã¡ãã£ããªãã¦ãã¨ã«ãªãã¨æ²ããã§ããã
ã ããã¨ãã£ã¦ãå ¬éããã½ã¼ã¹ã«ãã¡ãã¡ãã¹ã¯ããã®ã¯é¢åã§ããã
ãããªæãä»åç´¹ä»ããæ¹æ³ã§ä¸¸ã£ã¨è§£æ±ºãã¾ãããã
Web.configï¼App.configï¼ã使ã
ãã¼ãã³ã¼ãã£ã³ã°ã¯ããã¦å°ãªãã¨ãWeb.configã使ãã¾ãããããã ãWeb.configæ¬ä½ã«ã¯å ¬éãã¦ãåé¡ãªãããã«ãã¹ã¯ããå 容ã«ãã¦ããã¾ãã
- Web.config
<configuration> <appSettings file="D:\ç§å¯ã®è¨å®\local.config"> <add key="consumerKey" value="*****" /> <add key="consumerSecret" value="*****" /> <add key="accessToken" value="*****" /> <add key="accessSecret" value="*****" /> </appSettings> </configuration>
ãã¤ã³ãã¯appSettingsè¦ç´ ã«fileå±æ§ã§å¥ã®ãã¡ã¤ã«ï¼ä¾ã§ã¯local.configï¼ãæå®ãã¾ãããã®ãã¡ã¤ã«ã®ä¸ã«æ¸ãããå 容ãåªå ãã¦ä½¿ç¨ããã¾ãã
- local.config
<appSettings> <add key="consumerKey" value="æ¬æ¥ã®å¤" /> <add key="consumerSecret" value="æ¬æ¥ã®å¤" /> <add key="accessToken" value="æ¬æ¥ã®å¤" /> <add key="accessSecret" value="æ¬æ¥ã®å¤" /> </appSettings>
fileå±æ§ãæå®ããè¦ç´ ï¼appSettingsï¼ããæ¸ãå§ããå¿ è¦ãããã¾ãã*1
ãã¡ãããlocal.configã¯ãã¼ã¸ã§ã³ç®¡ç対象å¤ã¨ãªãããã«å¥ã®ãã¹ã«ç½®ãã¦ãããã.gitignoreã«å ¥ãã¦ããããã¦ããå¿ è¦ãããã¾ãã
ããã§æ¥ãããããªã
ããã§ãã¼ã«ã«ã§å®è¡ããéã«ã¯local.configã«æ¸ããå 容ã使ç¨ãããGitHubã«ã¯ãã¹ã¯ããå 容ãã¢ãããããããã«ãªãã¾ããã
ã¡ãªã¿ã«ãfileå±æ§ã§æå®ãããã¡ã¤ã«ããªãã¦ãã¨ã©ã¼ã«ã¯ãªãã¾ããã
Azure Webãµã¤ãã«ãããã¤ããå ´å
ããã«å ãã¦ãAzure Webãµã¤ãã«ãããã¤ããå ´åã¯ã©ããããã¨ããã¨ãWebãµã¤ãã®ãã¢ããªã±ã¼ã·ã§ã³ã®è¨å®ãã§ä¸æ¸ããã¦ããã¾ãã
*1:æ¸ãæ¹ã«åé¡ãããã°å®è¡æã«ã¨ã©ã¼ã«ãªãã¾ã