Environment Variables
Relevant source files
The following files were used as context for generating this wiki page:This document provides an analysis of the use of environment variables within the vandore-website-metera project. The system primarily operates as a static site server with some dynamic behavior handled by client-side JavaScript.
Based on the repository's source files, the application does not currently utilize environment variables for its core runtime configuration. Instead, key values such as the server port are hardcoded directly into the source code. This approach simplifies the initial setup but reduces deployment flexibility. The following sections detail the current configuration methods and identify areas where environment variables are notably absent.
Server Configuration
The main server logic is contained within server.js. This file is responsible for creating an HTTP server and serving the static files of the website. The configuration for this server is static and defined within the file itself.
Sources: server.js
Port Configuration
The port on which the server listens is hardcoded to 8000. This value is not sourced from the environment, meaning any change to the listening port requires a direct modification of the source code.
// server.js:5
const port = 8000;
Sources: server.js:5
The diagram below illustrates the current server startup flow, highlighting the use of the hardcoded port value.
This diagram shows the server startup process, which directly uses the hardcoded port value from server.js.
Sources: server.js:5, server.js:65, package.json:6-7
MIME Types
The server uses a hardcoded JavaScript object to map file extensions to their corresponding MIME types. This list is self-contained within server.js and is not configurable through external means.
// server.js:8-23
const mimeTypes = {
'.html': 'text/html',
'.css': 'text/css',
'.js': 'text/javascript',
'.json': 'application/json',
'.png': 'image/png',
'.jpg': 'image/jpeg',
'.jpeg': 'image/jpeg',
'.gif': 'image/gif',
'.svg': 'image/svg+xml',
'.ico': 'image/x-icon',
'.woff': 'font/woff',
'.woff2': 'font/woff2',
'.ttf': 'font/ttf',
'.eot': 'application/vnd.ms-fontobject'
};
Sources: server.js:8-23
Build and Execution Scripts
The package.json file defines the scripts for running the application. Both the dev and start scripts execute node server.js directly, without passing any environment variables.
| Script | Command | Description |
|---|---|---|
dev | node server.js | Runs the server for development. |
start | node server.js | Runs the server for production. |
Sources: package.json:5-8
This confirms that the application's execution does not depend on environment variables set at the command-line level.
Stackbit Configuration
The stackbit.config.ts file is used for configuring the Stackbit visual editor and content management system. This configuration is related to content modeling, file paths for content, and site mapping. It defines how Stackbit interacts with the content source but does not influence the runtime environment of the Node.js server. All paths and model definitions are statically defined within this file.
For example, the content source is configured with a hardcoded rootPath.
// stackbit.config.ts:8
new GitContentSource({
name: 'content',
rootPath: __dirname,
contentDirs: ['content'],
// ... models
})
Sources: stackbit.config.ts:8-11
Client-Side Logic
Client-side JavaScript, such as in js/submit-form.js, handles form submissions. The logic within these files is self-contained and does not rely on environment variables injected from the server. For instance, form actions and validation logic are hardcoded. The contact form submission is simulated with a setTimeout and does not post to a configurable endpoint.
The sequence diagram below shows the contact form submission process, which is entirely handled on the client side without server-side configuration.
Sources: js/submit-form.js:3-52, contact.html:260-285
Similarly, the property filtering logic on the properties.html page is managed entirely by client-side JavaScript, reading data from static data-* attributes in the HTML and not from any external configuration.
Sources: properties.html:220-394
Conclusion
The vandore-website-metera project currently employs a static configuration model where operational parameters, most notably the server port, are hardcoded. There is no evidence of the use of environment variables for runtime configuration in the Node.js server, build scripts, or client-side code. While this simplifies the current setup, introducing environment variables for settings like PORT would significantly improve the application's flexibility and align it with standard deployment practices for Node.js applications.