@@ -12,10 +12,11 @@ const (
1212)
1313
1414func MarkdownArticlesPath () string {
15+ root := os .Getenv ("ROOT_DIR" )
1516 if strings .Compare (os .Getenv ("ENV" ), "dev" ) == 0 {
16- return path .Join (Root , MarkdownArticlesPathBase , "dev" )
17+ return path .Join (root , MarkdownArticlesPathBase , "dev" )
1718 }
18- return path .Join (Root , MarkdownArticlesPathBase , "prod" )
19+ return path .Join (root , MarkdownArticlesPathBase , "prod" )
1920}
2021
2122func RetrieveLocalMdArticles () ([]string , error ) {
@@ -35,7 +36,7 @@ func RetrieveLocalMdArticles() ([]string, error) {
3536
3637func RetriveLocalHtmlArticle (article string ) (string , error ) {
3738 article += ".html"
38- file , err := os .ReadFile (path .Join (Root , HTMLArticlesPath , article ))
39+ file , err := os .ReadFile (path .Join (os . Getenv ( "ROOT_DIR" ) , HTMLArticlesPath , article ))
3940 if err != nil {
4041 return "" , err
4142 }
@@ -46,7 +47,7 @@ func RetriveLocalHtmlArticle(article string) (string, error) {
4647func PersistHtmlArticle (article string , content string ) error {
4748 article = strings .Replace (article , ".md" , ".html" , 1 )
4849
49- file , err := os .Create (path .Join (Root , HTMLArticlesPath , article ))
50+ file , err := os .Create (path .Join (os . Getenv ( "ROOT_DIR" ) , HTMLArticlesPath , article ))
5051 if err != nil {
5152 return err
5253 }
0 commit comments