Skip to content

Commit

Permalink
Update requirements.txt to point towards fork, Changes raw data api u…
Browse files Browse the repository at this point in the history
…rl to read from env variable , Moved mbtiles to top
  • Loading branch information
kshitijrajsharma committed Feb 7, 2024
1 parent 88c48c4 commit 225fd12
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs/setup-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Most of these environment variables have reasonable default settings.
- `GARMIN_CONFIG`, `GARMIN_MKGMAP` absolute paths to garmin JARs
- `OVERPASS_API_URL` url of Overpass api endpoint

- `RAW_DATA_API_URL` url of Galaxy api endpoint
- `RAW_DATA_API_URL` url of Raw data api endpoint

- `DATABASE_URL` Database URL. Defaults to `postgres:///exports`
- `DEBUG` Whether to enable debug mode. Defaults to `False` (production).
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ mercantile~=0.10.0
psycopg2
python3-openid==3.2.0
social-auth-app-django==5.4.0
social-auth-core==4.4.2 ### Upgrade this to include oauth2
social-auth-core @ git+https://github.com/kshitijrajsharma/social-core.git ### Upgrade this to include osm oauth2 when released
pytz
pyyaml>=5.3
raven
Expand Down
4 changes: 2 additions & 2 deletions ui/app/actions/exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ export const getOverpassTimestamp = () => (dispatch, getState) => {

export const getGalaxyTimestamp = () => (dispatch, getState) => {
return axios({
baseURL: "https://api-prod.raw-data.hotosm.org/v1",
url: "/status/"
baseURL: window.RAW_DATA_API_URL,
url: "v1/status/"
})
.then(response =>
dispatch({
Expand Down
4 changes: 4 additions & 0 deletions ui/app/actions/meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ if (window.location.port) {
hostname += `:${window.location.port}`;
}

if (window.RAW_DATA_API_URL == null) {
window.RAW_DATA_API_URL = process.env.RAW_DATA_API_URL;
}

if (window.EXPORTS_API_URL == null) {
window.EXPORTS_API_URL = process.env.EXPORTS_API_URL;

Expand Down
8 changes: 4 additions & 4 deletions ui/app/components/ExportForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export class ExportForm extends Component {
}

async fetchData(geometry) {
const url = "https://api-prod.raw-data.hotosm.org/v1/stats/polygon/";
const url = window.RAW_DATA_API_URL + "v1/stats/polygon/";
try {
const response = await axios.post(url, {
geometry: geometry
Expand All @@ -155,7 +155,7 @@ export class ExportForm extends Component {

renderFetchedInfo() {
const { fetchedInfo } = this.state;

if (!this.props.formValues.the_geom) return null;
if (!fetchedInfo) return null;

// Function to trigger the download of the raw data as a JSON file
Expand All @@ -172,7 +172,7 @@ export class ExportForm extends Component {
};

return (
<Panel style={{ marginTop: "5px" }}>
<Panel style={{ marginTop: "10px" }}>
<div>
<div>
<strong style={{ fontSize: "smaller" }}>Buildings:</strong>
Expand Down Expand Up @@ -365,7 +365,7 @@ export class ExportForm extends Component {
<Panel style={{ marginTop: "20px" }}>
<FormattedMessage
id="ui.overpass_last_updated"
defaultMessage="Img/pbf/obf/ updated {overpassLastUpdated}, Rest of other formats updated {galaxyLastUpdated} "
defaultMessage="Img/pbf/obf updated {overpassLastUpdated}, Rest of other formats updated {galaxyLastUpdated} "
values={{ overpassLastUpdated, galaxyLastUpdated }}
/>
</Panel>
Expand Down
10 changes: 5 additions & 5 deletions ui/app/components/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ export const AVAILABLE_EXPORT_FORMATS = {
SQL <code>.sql</code>
</span>
),
mbtiles: (
<span key="mbtiles">
MBTiles <code>.mbtiles</code>
</span>
),
garmin_img: (
<span key="garmin_img">
Garmin <code>.img</code>
Expand All @@ -83,11 +88,6 @@ export const AVAILABLE_EXPORT_FORMATS = {
OsmAnd <code>.obf</code>
</span>
),
mbtiles: (
<span key="osmand_obf">
MBTiles <code>.mbtiles</code>
</span>
),
bundle: (
<span key="bundle">
<a href="http://posm.io/">POSM</a> bundle
Expand Down
1 change: 1 addition & 0 deletions ui/templates/ui/v3.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<script>
var EXPORTS_API_URL = "{{ request.scheme }}://{{ request.get_host }}";
var OAUTH_CLIENT_ID = "{{ client_id }}";
var RAW_DATA_API_URL = "{{ RAW_DATA_API_URL }}";
</script>
<script src="{% static 'ui/js/bundle.js' %}"></script>
</body>
Expand Down
4 changes: 3 additions & 1 deletion ui/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ def v3(request, *args, **kwargs):
skip_authorization=True,
)

context = dict(client_id=ui_app.client_id)
context = dict(
client_id=ui_app.client_id, RAW_DATA_API_URL=settings.RAW_DATA_API_URL
)
if settings.MATOMO_URL is not None and settings.MATOMO_SITEID is not None:
context.update(
{"MATOMO_URL": settings.MATOMO_URL, "MATOMO_SITEID": settings.MATOMO_SITEID}
Expand Down
4 changes: 3 additions & 1 deletion ui/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ const config = {
plugins: [new webpack.DefinePlugin({
"process.env": {
CLIENT_ID: JSON.stringify(process.env.CLIENT_ID),
EXPORTS_API_URL: JSON.stringify(process.env.EXPORTS_API_URL)
EXPORTS_API_URL: JSON.stringify(process.env.EXPORTS_API_URL),
RAW_DATA_API_URL: JSON.stringify(process.env.RAW_DATA_API_URL)
}
}), new webpack.NamedModulesPlugin(), new WriteFilePlugin()],
resolve: {
Expand All @@ -110,6 +111,7 @@ if (process.env.NODE_ENV === "production") {
"process.env": {
CLIENT_ID: JSON.stringify(process.env.CLIENT_ID),
EXPORTS_API_URL: JSON.stringify(process.env.EXPORTS_API_URL),
RAW_DATA_API_URL: JSON.stringify(process.env.RAW_DATA_API_URL),
NODE_ENV: JSON.stringify("production")
}
}),
Expand Down

0 comments on commit 225fd12

Please sign in to comment.