1717 API string
1818
1919 // fetch current working directory
20- NHOST_DIR string
21- DOT_NHOST string
22- DOT_NHOST_ROOT = filepath .Join (util .WORKING_DIR , ".nhost" )
20+ NHOST_DIR string
21+ DOT_NHOST string
2322
2423 // initialize the names of all Nhost services in the stack
2524 SERVICES []string
7372 GITIGNORE string
7473
7574 // path for .nhost/nhost.yaml file
76- INFO_PATH = filepath . Join ( DOT_NHOST_ROOT , "nhost.yaml" )
75+ INFO_PATH string
7776
7877 // path for express NPM modules
7978 NODE_MODULES_PATH string
@@ -91,118 +90,74 @@ var (
9190// Initialize Nhost variables for runtime
9291func Init () {
9392
94- if DOMAIN == "" {
95- DOMAIN = "nhost.run"
96- }
93+ DOMAIN = "nhost.run"
9794
98- if API == "" {
99- API = fmt .Sprintf ("https://%s/v1/functions" , DOMAIN )
100- }
95+ API = fmt .Sprintf ("https://%s/v1/functions" , DOMAIN )
10196
10297 // fetch current working directory
103- if NHOST_DIR == "" {
104- NHOST_DIR = filepath .Join (util .WORKING_DIR , "nhost" )
105- }
98+ NHOST_DIR = filepath .Join (util .WORKING_DIR , "nhost" )
10699
107- if DOT_NHOST == "" {
108- DOT_NHOST , _ = GetDotNhost ()
109- }
100+ INFO_PATH = filepath . Join ( util . WORKING_DIR , ".nhost" , "nhost.yaml" )
101+
102+ DOT_NHOST , _ = GetDotNhost ()
110103
111104 // initialize the names of all Nhost services in the stack
112- if SERVICES == nil {
113- SERVICES = []string {"hasura" , "auth" , "storage" , "mailhog" , "postgres" , "minio" }
114- }
105+ SERVICES = []string {"hasura" , "auth" , "storage" , "mailhog" , "postgres" , "minio" }
115106
116107 // find user's home directory
117- if HOME == "" {
118- HOME , _ = os .UserHomeDir ()
119- }
108+ HOME , _ = os .UserHomeDir ()
120109
121110 // Nhost root directory for HOME
122- if ROOT == "" {
123- ROOT = filepath .Join (HOME , ".nhost" )
124- }
111+ ROOT = filepath .Join (HOME , ".nhost" )
125112
126113 // authentication file location
127- if AUTH_PATH == "" {
128- AUTH_PATH = filepath .Join (ROOT , "auth.json" )
129- }
114+ AUTH_PATH = filepath .Join (ROOT , "auth.json" )
130115
131116 // path for migrations
132- if MIGRATIONS_DIR == "" {
133- MIGRATIONS_DIR = filepath .Join (NHOST_DIR , "migrations" )
134- }
117+ MIGRATIONS_DIR = filepath .Join (NHOST_DIR , "migrations" )
135118
136119 // path for metadata
137- if METADATA_DIR == "" {
138- METADATA_DIR = filepath .Join (NHOST_DIR , "metadata" )
139- }
120+ METADATA_DIR = filepath .Join (NHOST_DIR , "metadata" )
140121
141122 // default Nhost database
142- if DATABASE == "" {
143- DATABASE = "default"
144- }
123+ DATABASE = "default"
145124
146125 // path for seeds
147- if SEEDS_DIR == "" {
148- SEEDS_DIR = filepath .Join (NHOST_DIR , "seeds" )
149- }
126+ SEEDS_DIR = filepath .Join (NHOST_DIR , "seeds" )
150127
151128 // path for frontend
152- if WEB_DIR == "" {
153- WEB_DIR = filepath .Join (util .WORKING_DIR , "web" )
154- }
129+ WEB_DIR = filepath .Join (util .WORKING_DIR , "web" )
155130
156131 // path for API code
157- if API_DIR == "" {
158- API_DIR = filepath .Join (util .WORKING_DIR , "functions" )
159- }
132+ API_DIR = filepath .Join (util .WORKING_DIR , "functions" )
160133
161134 // path for email templates
162- if EMAILS_DIR == "" {
163- EMAILS_DIR = filepath .Join (NHOST_DIR , "emails" )
164- }
135+ EMAILS_DIR = filepath .Join (NHOST_DIR , "emails" )
165136
166137 // path for legacy migrations
167- if LEGACY_DIR == "" {
168- LEGACY_DIR = filepath .Join (DOT_NHOST , "legacy" )
169- }
138+ LEGACY_DIR = filepath .Join (DOT_NHOST , "legacy" )
170139
171140 // path for local git directory
172- if GIT_DIR == "" {
173- GIT_DIR = filepath .Join (util .WORKING_DIR , ".git" )
174- }
141+ GIT_DIR = filepath .Join (util .WORKING_DIR , ".git" )
175142
176143 // path for .env.development
177- if ENV_FILE == "" {
178- ENV_FILE = filepath .Join (util .WORKING_DIR , ".env.development" )
179- }
144+ ENV_FILE = filepath .Join (util .WORKING_DIR , ".env.development" )
180145
181146 // path for .config.yaml file
182- if CONFIG_PATH == "" {
183- CONFIG_PATH = filepath .Join (NHOST_DIR , "config.yaml" )
184- }
147+ CONFIG_PATH = filepath .Join (NHOST_DIR , "config.yaml" )
185148
186149 // path for .gitignore file
187- if GITIGNORE == "" {
188- GITIGNORE = filepath .Join (util .WORKING_DIR , ".gitignore" )
189- }
150+ GITIGNORE = filepath .Join (util .WORKING_DIR , ".gitignore" )
190151
191152 // path for express NPM modules
192- if NODE_MODULES_PATH == "" {
193- NODE_MODULES_PATH = filepath .Join (ROOT , "node_modules" )
194- }
153+ NODE_MODULES_PATH = filepath .Join (ROOT , "node_modules" )
195154
196155 // package repository to download latest release from
197- if REPOSITORY == "" {
198- REPOSITORY = "nhost/cli"
199- }
156+ REPOSITORY = "nhost/cli"
200157
201158 // initialize the project prefix
202159 // PREFIX = filepath.Base(util.WORKING_DIR)
203- if PREFIX == "" {
204- PREFIX = "nhost"
205- }
160+ PREFIX = "nhost"
206161
207162 // mandatorily required locations
208163 LOCATIONS = Required {
0 commit comments